K8s by Example: DaemonSets
| DaemonSets ensure one Pod runs on every node (or selected nodes). When nodes join, they get a Pod. When nodes leave, Pod is garbage collected. Use for: log collectors, monitoring agents, network plugins. |
| daemonset.yaml | |
| DaemonSet ensures one Pod per node. No | |
| daemonset-host.yaml | |
| Access host resources with hostPath volumes and hostNetwork. Common for log collection, node monitoring, and network plugins. Be careful because hostPath breaks container isolation. | |
| daemonset-tolerations.yaml | |
| Tolerations allow DaemonSets to run on tainted nodes. First toleration: run on control plane nodes. Second toleration: tolerate all taints (run everywhere). Or use nodeSelector to target specific nodes. | |
| daemonset-update.yaml | |
| Update strategies: | |
| daemonset-affinity.yaml | |
| DaemonSet Pods are scheduled by the DaemonSet controller, not the scheduler. Node affinity still works for selecting which nodes get Pods. They also ignore PodDisruptionBudgets during updates. | |
| terminal | |
| Debug DaemonSets by checking desired vs ready count and inspecting Pods per node. Common issues: taints preventing scheduling, resource constraints, image pull failures. | |