DaemonSets

DaemonSets

One Pod per node - automatically, including nodes that join later.

graph TB DS[DaemonSet log-agent] --> P1[Pod on worker01] DS --> P2[Pod on worker02] DS --> P3[Pod on worker03] N[new node joins] -.-> P4[Pod created automatically]

No replicas field - the node list is the replica count.

Typical users: CNI agents (calico-node), kube-proxy, log shippers, node exporters, storage drivers. Your cluster already runs several: kubectl get ds -A.

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: node-logger
spec:
  selector:
    matchLabels: { app: node-logger }
  template:
    metadata:
      labels: { app: node-logger }
    spec:
      containers:
        - name: logger
          image: busybox:1.36
          command: ["sh", "-c", "while true; do date; sleep 30; done"]
  • Control plane skipped: control01 has a NoSchedule taint. Add a toleration to run there (that is how calico-node and kube-proxy get there).
  • Subset of nodes: nodeSelector, e.g. only nodes labelled storage=nfs.
  • Updates: RollingUpdate (default, node by node) or OnDelete.

References