OpenShift DaemonSet Concepts

From NovaOrdis Knowledge Base
Revision as of 01:13, 28 February 2018 by Ovidiu (talk | contribs) (→‎Overview)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

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:

DaemonSet Definition

The DamonSet picks nodes to place pods on based on a node selector expression. The labels that are part of the node selector expression must be declared in the DaemonSet definition as shown below:

...
spec:
  template:
    spec:
      nodeSelector:
        logging-infra-fluentd: "true"
...

In order to become eligible for scheduling, the node must also be configured to expose the same labels.

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 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 
...

In order to become eligible to be managed by the DaemonSet, the pod definition must declare the same labels, in the pod template’s label selector.

DaemonSet.png

After a successful placement, the node selector expression is recorded in the pod's definition.

Accessing Node Resources

Accessing Node Directories

Node directories can be accessed as a hostPaths.

DaemonSet Operations