While ReplicaSets ensure that a set number of Pod replicas are running across the cluster, DaemonSets guarantee that one copy of the Pod is present on every node.
Use Cases for DaemonSets
DaemonSets are primarily used in the following scenarios:- Monitoring and Logging: Deploy agents responsible for system monitoring and log collection across all nodes.
- Networking: Ensure a networking solution agent (e.g., VNet components or weave-net) is deployed on every node.
- Critical Infrastructure Components: Deploy essential components like kube-proxy that need to reside on every node.



Creating a DaemonSet
Creating a DaemonSet is quite similar to creating a ReplicaSet. The YAML definition file begins withapiVersion, kind, metadata, and spec sections. The primary difference is that the kind is set to DaemonSet, and it manages a Pod on every node rather than a specified number of replicas.
Below is an example DaemonSet definition file:
kind:
selector match those in the Pod template to guarantee proper functioning. Once your DaemonSet definition is ready, create it using the following kubectl command:
How DaemonSets Work
DaemonSets automatically schedule Pods on every node in your cluster. In earlier Kubernetes versions, thenodeName property was used to assign Pods directly to nodes, bypassing the scheduler. However, since version 1.12, DaemonSets leverage the default scheduler and node affinity rules to manage Pod placement.

- Monitoring
- Logging
- Networking