DevOps Classroom notes 12/Oct/2026

DaemonSet:

  • DaemonSet ensure create pod on each node
  • Ex: Logs , Networking , node-agent …etc

Create DaemonSet yaml

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: demonset-demo
spec:
  selector:
    matchLabels:
      name: demonset-demo
  template:
    metadata:
      labels:
        name: demonset-demo
    spec:
      containers:
        - name: apache2
          image: httpd:2.4
          ports:
            - containerPort: 80

Statefulset:

  • Stable and uniq pods names like po-0, po-1, po-2 …etc
  • Each pod will have its own storage (pvc)
  • while scale up pods like po-0, po-1, po-2 but scale down po-2, po-1, po-0
  • sequance order to scale down and scaleup pods
  • each pod will have its own dns (Ex: Mysql-o.mysql.namespace.svc.cluster.local )

kubedns for statefulset pod <podname>.<statefulsetName>.<NameSpace>.svc.cluster.local

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: statefulset-demo
spec:
  replicas: 3
  selector:
    matchLabels:
      app: statefulset-demo
  serviceName: "statefulset-demo"
  template:
    metadata:
      labels:
        app: statefulset-demo
    spec:
      containers:
        - name: apache2
          image: httpd:2.4
          ports:
            - containerPort: 80
  volumeClaimTemplates:
    - metadata:
        name: statefulset-demo-storage
      spec:
        accessModes: ["ReadWriteOnce"]
        resources:
          requests:
            storage: 1Gi

Job

  • job can create one or more pods and enasure to complete or backoflimit (6) try to restart pods
  • Usecases:
    • db migration
    • data ingestions
    • automation scrpits


apiVersion: batch/v1
kind: Job
metadata:
  name: samplejob
  labels:
    env: dev
    app: data-job
spec:
  backoffLimit: 4
  template:
    spec:
      containers:
        - name: pi
          image: perl:5.34.0
          command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
        - name: demo-sleep
          image: bitnami/os-shell
          command: ["echo", "hello world"]
      restartPolicy: Never

CronJOb:

  • cronjob will schedule job based on cron time.

Sample cron expression

apiVersion: batch/v1
kind: CronJob
metadata:
  name: hello
spec:
  schedule: "* * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: hello
            image: busybox:1.28
            imagePullPolicy: IfNotPresent
            command:
            - /bin/sh
            - -c
            - date; echo Hello from the Kubernetes cluster
          restartPolicy: OnFailure

Choosing the which workload

  1. POD ==> test/dev enviromnet
  2. Deploymnet ==> web app, apis, front-end , backend services
  3. Deamonset: monitoring, logs application, network plugin, routing …etc
  4. Statefulset: db, where pod need unique name and pvc
  5. Job: run the task or activity (automation and data injections)
  6. CRonjob: used schedule jobs (run job on specific time zone)
  7. Replicaset: which scale pods ==> Deployment Recommed
  8. Replicas-controller -old method for replicas set (scale pods).

Task:

  1. create different multiple templates for each workload
    1. deployment use NoP
    2. Statefulset use mysql db
  2. try access all application by port-farword cmd.

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%