DaemonSet Fundamentals
What you'll learn: How to use DaemonSets to automatically run one copy of a pod on every node in your Kubernetes cluster.
What Is a DaemonSet?
A DaemonSet ensures that all (or some) nodes in your cluster run an exact copy of a specific pod. Think of it like installing a system-wide utility on every computer in an office—each machine gets its own copy automatically.
Unlike Deployments or ReplicaSets where you specify how many replicas you want, a DaemonSet says "I want this pod on every node"—the count is determined by the number of nodes.
When to Use DaemonSets
DaemonSets are perfect for node-level tasks that need to run everywhere:
- Log collectors: Gathering logs from every node (like Fluentd or Logstash agents)
- Monitoring agents: Collecting metrics from each node (like Prometheus Node Exporter)
- Network plugins: Managing networking on every node (like Calico or Weave)
- Storage daemons: Providing storage capabilities per node
How DaemonSets Work
When you create a DaemonSet:
- The controller watches for existing and new nodes
- It automatically schedules a pod on each qualifying node
- If a node is added, the pod is deployed there automatically
- If a node is removed, the pod is cleaned up
- If you delete the DaemonSet, all its pods are removed
The beauty is the automatic distribution—no manual intervention needed as your cluster grows or shrinks.
Key Takeaway: DaemonSets ensure exactly one copy of a pod runs on every node in your cluster, making them ideal for cluster-wide services like monitoring, logging, and networking that must exist on each node.