DaemonSets manage Pods and are a resource in the apps
API group. They’re useful when you need a replica of a particular Pod running on every node in the cluster. Some examples include monitoring Pods and logging Pods that you need to run on every node in the cluster.
As you’d expect, it implements a controller and a watch loop. This means that you can dynamically add and remove nodes from the cluster, and the DaemonSet will ensure you always have one Pod replica on each of them.
The following command shows two DaemonSets in the kube-system
namespace that exist on a newly installed 3-node cluster.
The output is trimmed so that it fits the page.
kubectl get ds -n kube-systemNAME DESIRED CURRENT READY NODE SELECTORkube-proxy 3 3 3 beta.kubernetes.io/arch=amd64weave-net 3 3 3 <none>
Notice that the desired state for each DaemonSet is 3 replicas. You do not need to specify this in the DaemonSet YAML file, as it is automatically implied based on the number of nodes in the cluster.
As well as the default behavior of running one Pod replica on every cluster node, you can also run DaemonSets against subsets of nodes.
DaemonSets are stable in the apps/v1
API group and can be managed with the usual kubectl get
, and kubectl describe
commands. If you already understand Pods and Deployments, you will find DaemonSets really simple.
Get hands-on with 1400+ tech skills courses.