kubernetesdaemonset

Will a daemonset always be deployed to all nodes?


I'm wondering if a daemonset in kubernetes will always be deployed to all nodes.

My confusion comes from the following description of a daemonset

A DaemonSet makes sure that all or some kubernetes Nodes run a copy of a Pod.

The "or some" part, implies that there are cases when some nodes won't run a pod. For my use case it would be important that all nodes would run an instance. What are the cases in which a node won't run an instance of a pod, even though it is deployed as a daemonset?


Solution

  • It depends on which target of nodes are selected.

    If you specify a .spec.template.spec.nodeSelector, then the DaemonSet controller will create Pods on nodes which match that node selector. Likewise if you specify a .spec.template.spec.affinity, then DaemonSet controller will create Pods on nodes which match that node affinity. If you do not specify either, then the DaemonSet controller will create Pods on all nodes.DaemonSet

    Also I would check the taint and toleration for Daemonset.