OpenShift DaemonSet Concepts: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 18: Line 18:
{{Internal|OpenShift DaemonSet Definition|DaemonSet Definition}}
{{Internal|OpenShift DaemonSet Definition|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:
The DamonSet picks nodes to place pods on based on a [[OpenShift Concepts#Node_Selector|node selector]] expression. First off, the labels that are part of the node selector expression must be declared in the DaemonSet definition:


  ...
  ...
Line 28: Line 28:
  ...
  ...


When a pod is managed by a DaemonSet, the node the pod is scheduled to run on is selected by the DaemonSet, so the [[OpenShift Concepts#Scheduler|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 [[OpenShift Concepts#Node_Selector|node selector]] specified in its definition:
The node must also be configured to expose the labels.
 
...
'''Node-Selector''': logging=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 [[OpenShift Concepts#Scheduler|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 [[OpenShift Concepts#Selector|label selector]] expression specified in its [[OpenShift DaemonSet Definition#spec_selector|definition]]:
The DaemonSet decides whether it manages a pod or not based on the [[OpenShift Concepts#Selector|label selector]] expression specified in its [[OpenShift DaemonSet Definition#spec_selector|definition]]:
Line 45: Line 42:
  ...
  ...


Note that internally, the declared pod template’s label selector [[OpenShift DaemonSet Definition#template_metadata_labels|must match the label selector above]].
In order to become eligible to be managed by the DaemonSet, the pod definition must declare the same labels, in the pod template’s [[OpenShift DaemonSet Definition#template_metadata_labels|label selector]].


[[Image:DaemonSet.png]]
[[Image:DaemonSet.png]]

Revision as of 18:14, 9 February 2018

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. First off, the labels that are part of the node selector expression must be declared in the DaemonSet definition:

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

The node must also be configured to expose the 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.

DaemonSet Operations