This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 25. Using Daemonsets
25.1. Overview 링크 복사링크가 클립보드에 복사되었습니다!
A daemonset can be used to run replicas of a pod on specific or all nodes in an OpenShift Container Platform cluster.
Use daemonsets to create shared storage, run a logging pod on every node in your cluster, or deploy a monitoring agent on every node.
For security reasons, only cluster administrators can create daemonsets. (Granting Users Daemonset Permissions.)
For more information on daemonsets, see the Kubernetes documentation.
Daemonset scheduling is incompatible with project’s default node selector. If you fail to disable it, the daemonset gets restricted by merging with the default node selector. This results in frequent pod recreates on the nodes that got unselected by the merged node selector, which in turn puts unwanted load on the cluster.
Therefore,
-
Before you start using daemonsets, disable the default project-wide node selector in your namespace, by setting the namespace annotation
openshift.io/node-selector
to an empty string:
oc patch namespace myproject -p \ '{"metadata": {"annotations": {"openshift.io/node-selector": ""}}}'
# oc patch namespace myproject -p \
'{"metadata": {"annotations": {"openshift.io/node-selector": ""}}}'
-
If you are creating a new project, overwrite the default node selector using
oc adm new-project --node-selector=""
.
25.2. Creating Daemonsets 링크 복사링크가 클립보드에 복사되었습니다!
When creating daemonsets, the nodeSelector
field is used to indicate the nodes on which the daemonset should deploy replicas.
Define the daemonset yaml file:
Create the daemonset object:
oc create -f daemonset.yaml
oc create -f daemonset.yaml
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To verify that the pods were created, and that each node has a pod replica:
Find the daemonset pods:
oc get pods
$ oc get pods hello-daemonset-cx6md 1/1 Running 0 2m hello-daemonset-e3md9 1/1 Running 0 2m
Copy to Clipboard Copied! Toggle word wrap Toggle overflow View the pods to verify the pod has been placed onto the node:
oc describe pod/hello-daemonset-cx6md|grep Node oc describe pod/hello-daemonset-e3md9|grep Node
$ oc describe pod/hello-daemonset-cx6md|grep Node Node: openshift-node01.hostname.com/10.14.20.134 $ oc describe pod/hello-daemonset-e3md9|grep Node Node: openshift-node02.hostname.com/10.14.20.137
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
- If you update a DaemonSet’s pod template, the existing pod replicas are not affected.
- If you delete a DaemonSet and then create a new DaemonSet with a different template but the same label selector, it recognizes any existing pod replicas as having matching labels and thus does not update them or create new replicas despite a mismatch in the pod template.
- If you change node labels, the DaemonSet adds pods to nodes that match the new labels and deletes pods from nodes that do not match the new labels.
To update a DaemonSet, force new pod replicas to be created by deleting the old replicas or nodes.