DaemonSet are kubernetes objects that run a single pod on each node of the cluster.
These single pods usually run some kind of a service throughout the cluster.
DaemonsSets bypass the kubernetes Scheduler.
The flannel networking frame could is a good example of a daemonSet.
Each node of the cluster needs a flannel "agent" so that the pods can communicate with each other throughout the cluster.
The daemonSet makes sure that one copy of a pod is running on each node.
We could also specify the nodes on which we want our pods to run using the "nodeSelector" parameter in the Yaml file of daemonSet.
Below is a YAML file of a DaemonSet that deploys one pod on nodes that have the label "hardware: SSD".
The pod is our example below runs a simple command.
We can label a node using the below command:
An alternative to using DeamonSet is static pods.
Static pods are started by the kubelet, and in case of a crash the kubelet restarts the failing pod.
The kubelet regularly scans its manifest directory, to check for new static pods to start - when we add a new Yaml file for a pod in the manifest directory - or static pods to delete - when their Yaml file gets deleted from the manifest directory -