OpenShift DaemonSet Operations: Difference between revisions
(14 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
* [[OpenShift Operations#Subjects|OpenShift Operations]] | * [[OpenShift Operations#Subjects|OpenShift Operations]] | ||
* [[OpenShift Concepts | * [[OpenShift DaemonSet Concepts|DaemonSet Concepts]] | ||
=Obtaining Information about DaemonSets= | =Obtaining Information about DaemonSets= | ||
Line 31: | Line 31: | ||
No events. | No events. | ||
= | Also: | ||
oc get daemonsets | |||
oc get -o yaml daemonset logging-fluentd | |||
=DaemonSet LifeCycle= | |||
==Creation== | |||
Monitor project's events with | |||
oc get events | |||
for errors. | |||
=Updating Pods Managed by DaemonSets= | ==Updating Pods Managed by DaemonSets== | ||
As long as a pod managed by a DaemonSet is running, it is impervious to changes in its own template: the DaemonSet won't react and attempt to stop it and recreate it. This behavior is consistent with the [[OpenShift Concepts#Pod_Configuration|static nature of running pods]]. Moreover, if the definition of a DaemonSet-managed pod is completely deleted, and then recreated based on a new template, but the same label selector, the DaemonSet will recognize any running pod replicas as having matching labels and thus will not update them or create new replicas despite a mismatch in the pod template. | As long as a pod managed by a DaemonSet is running, it is impervious to changes in its own template: the DaemonSet won't react and attempt to stop it and recreate it. This behavior is consistent with the [[OpenShift Concepts#Pod_Configuration|static nature of running pods]]. Moreover, if the definition of a DaemonSet-managed pod is completely deleted, and then recreated based on a new template, but the same label selector, the DaemonSet will recognize any running pod replicas as having matching labels and thus will not update them or create new replicas despite a mismatch in the pod template. | ||
Line 42: | Line 53: | ||
To update the pods managed by a DaemonSet, update the pod's template, and force new pod replica creation by deleting the existing replicas. | To update the pods managed by a DaemonSet, update the pod's template, and force new pod replica creation by deleting the existing replicas. | ||
==Updating the DaemonSet Definition== | ===Updating the DaemonSet Definition=== | ||
oc edit daemonset/''<daemon-set-name>'' | oc edit daemonset/''<daemon-set-name>'' | ||
==Procedure== | ===Procedure=== | ||
1. Update the DaemonSet definition, if needed. | 1. Update the DaemonSet definition, if needed. | ||
2. Update the pod definition, if needed. | 2. [[OpenShift_Pod_Operations#Update_a_Pod_Defintion|Update the pod definition]], if needed. | ||
3. [[OpenShift_Pod_Operations#Stopping_Pods|Delete the existing pods]], they will be recreated by the DaemonSet: | 3. [[OpenShift_Pod_Operations#Stopping_Pods|Delete the existing pods]], they will be recreated by the DaemonSet: | ||
Line 57: | Line 68: | ||
oc delete pod/logging-fluentd-d150b | oc delete pod/logging-fluentd-d150b | ||
... | ... | ||
===Image Updates=== | |||
If the image is updated in the repository, deleting the pod will pull the latest image upon re-creation. | |||
=Creating Daemon Sets= | |||
A DaemonSet can be created using the template described below. A template can also be [[OpenShift_Template_Operations#Create_Templates_from_Existing_Objects|generated from an existing daemonset]], like "logging"/fluentd: | |||
oc export ds/logging-fluentd --as-template=daemonset-template > daemonset-template.yaml | |||
{{External|https://docs.openshift.com/container-platform/3.7/dev_guide/daemonsets.html#dev-guide-creating-daemonsets}} |
Latest revision as of 01:13, 13 February 2018
External
Internal
Obtaining Information about DaemonSets
The name of the DaemonSet that manages a pod is available in pod's "oc describe pod" output, as value for the "Controllers:" label. That value can be used to get the DaemonSet definition:
oc describe DaemonSet/<daemon-set-name>
Example:
oc describe DaemonSet/logging-fluentd
Name: logging-fluentd Image(s): registry.access.redhat.com/openshift3/logging-fluentd:3.5.0 Selector: component=fluentd,provider=openshift Node-Selector: logging-infra-fluentd=true Labels: component=fluentd logging-infra=fluentd provider=openshift Desired Number of Nodes Scheduled: 7 Current Number of Nodes Scheduled: 7 Number of Nodes Misscheduled: 0 Pods Status: 2 Running / 0 Waiting / 0 Succeeded / 5 Failed No events.
Also:
oc get daemonsets
oc get -o yaml daemonset logging-fluentd
DaemonSet LifeCycle
Creation
Monitor project's events with
oc get events
for errors.
Updating Pods Managed by DaemonSets
As long as a pod managed by a DaemonSet is running, it is impervious to changes in its own template: the DaemonSet won't react and attempt to stop it and recreate it. This behavior is consistent with the static nature of running pods. Moreover, if the definition of a DaemonSet-managed pod is completely deleted, and then recreated based on a new template, but the same label selector, the DaemonSet will recognize any running pod replicas as having matching labels and thus will not update them or create new replicas despite a mismatch in the pod template.
To update the pods managed by a DaemonSet, update the pod's template, and force new pod replica creation by deleting the existing replicas.
Updating the DaemonSet Definition
oc edit daemonset/<daemon-set-name>
Procedure
1. Update the DaemonSet definition, if needed.
2. Update the pod definition, if needed.
3. Delete the existing pods, they will be recreated by the DaemonSet:
oc delete pod/logging-fluentd-3kz30 oc delete pod/logging-fluentd-d150b ...
Image Updates
If the image is updated in the repository, deleting the pod will pull the latest image upon re-creation.
Creating Daemon Sets
A DaemonSet can be created using the template described below. A template can also be generated from an existing daemonset, like "logging"/fluentd:
oc export ds/logging-fluentd --as-template=daemonset-template > daemonset-template.yaml