Platform

You just apply the DaemonSet YAML and Kubernetes automatically creates one pod on every node for you. Same with Deployment — you never manually create pods either. You just define the desired state and Kubernetes handles the actual pod creation.

What is a DaemonSet?

A DaemonSet ensures that one pod runs on every node in the cluster. When a new node is added, a pod is automatically scheduled on it. When a node is removed, the pod is cleaned up.

You don't define replicas — the node count is the replica count.


DaemonSet vs Deployment

Deployment DaemonSet
You define replicas Yes No
Pods per node Could be many or none Exactly 1 per node
Use case Running your app Running something on every node
Scales with Manual or HPA Number of nodes

When to Use DaemonSet

Use it when you need something running on every single node — not your main app, but supporting tools like:

These things need to run on every node because they monitor or collect from that specific node.


DaemonSet YAML

kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: nginx-daemonsets
  namespace: nginx
spec:
  selector:
    matchLabels:
      app: nginx            # manages pods with this label
  template:
    metadata:
      name: nginx-dmn-pod
      labels:
        app: nginx          # must match selector above
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

Notice there is no replicas field — DaemonSet does not need it. One pod per node is automatic.