OpenShift DaemonSet Concepts
External
- https://docs.openshift.com/container-platform/latest/dev_guide/daemonsets.html
- https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/
Internal
Overview
A DaemonSet is a project-scoped OpenShift component that creates its associated pods and ensures they run on all (or some) nodes of a cluster. It is one of the pod controller types available in OpenShift.
If a node is added to the cluster, the DaemonSet insures that its associated pod will be scheduled on that node. When nodes are removed, the associated pods are shut down. Typical uses for DaemonSets are to run log collection agents (fluentd, logstash), node monitoring agents (collectd) or a cluster storage daemon (glusterd, ceph). Usually, a DaemonSet is needed for each type of daemon.
Example of DaemonSet definition:
The DamonSet picks nodes to place pods on based on a node selector expression. First off, the labels that are part of the node selector expression are declared in the DaemonSet definition:
... spec: template: spec: nodeSelector: logging-infra-fluentd: "true" ...
When a pod is managed by a DaemonSet, the node the pod is scheduled to run on is selected by the DaemonSet, so the scheduler ignores it. The "unschedulable" field of a node is not respected by the DaemonSet controller. Also, the DaemonSet controller can make pods even if the scheduler has not been started, and this helps with cluster bootstrap. The DaemonSet chooses the nodes to run its pods on based on the node selector specified in its definition:
... Node-Selector: logging=true ...
The DaemonSet decides whether it manages a pod or not based on the label selector expression specified in its definition:
... spec: selector: matchLabels: component: fluentd provider: openshift ...
Note that internally, the declared pod template’s label selector must match the label selector above.
After a successful placement, the node selector expression is recorded in the pod's definition.