AKS 3- What is a DaemonSet?

A DaemonSet is used when you want the same pod to run on all (or selected) machines automatically.
🛠️ What Daemon Sets Do (in layman terms):

Imagine you have a fleet of delivery trucks (nodes), and you want to:

  • Install GPS on every truck.
  • Ensure each truck has a fire extinguisher.
  • Track fuel usage from every truck.

Instead of manually installing these tools on each truck, you use a system (Daemon Set) that automatically installs and runs these tools on every truck.

Kubernetes takes care of it for you.

You write the YAML once, and Kubernetes puts that pod on every machine.

Think of it like this:

“You tell your office manager to put the same poster on all desks. Now, you don’t need to do it yourself—it happens automatically!”

Do You Need to Write Manifest Files for These DaemonSets?

System DaemonSets (Managed by AKS)

You do not need to write manifest files for the following — AKS automatically deploys and manages them:

When to use which?

  • Use Static Pod: When setting up core system components or starting Kubernetes itself.
  • Use DaemonSet: When you want something to run on all nodes automatically (like logs collector or antivirus).

Example of DaemonSet (Monitoring Agent)

apiVersion: apps/v1

kind: DaemonSet

metadata:

  name: fluentbit

  namespace: kube-system

spec:

  selector:

    matchLabels:

      name: fluentbit

  template:

    metadata:

      labels:

        name: fluentbit

    spec:

      containers:

      – name: fluentbit

        image: fluent/fluent-bit:latest

        resources:

          limits:

            memory: “200Mi”

            cpu: “100m”

        volumeMounts:

        – name: varlog

          mountPath: /var/log

      volumes:

      – name: varlog

        hostPath:

          path: /var/log

Side car also we can use but its not work on node level , it work on pod level.

If you use a DaemonSet, Kubernetes will automatically create one pod on each node in your cluster — no manual step needed for each node.

🔁 What happens automatically:

  • You deploy a DaemonSet once.
  • Kubernetes watches all nodes.
  • As soon as a node exists, one pod is created there.
  • If a new node is added later, it also gets the pod.

📦 Use cases:

  • Running log collectors (e.g., Fluentd)
  • Running monitoring agents (e.g., Prometheus Node Exporter)
  • Custom scripts or services you want on every node

Leave a Reply

Your email address will not be published. Required fields are marked *