Remote worker node strategies
You can review the following information to understand how to mitigate problems associated with power or connection loss with remote worker nodes.
If you use remote worker nodes, consider which objects to use to run your applications.
You can use daemon sets or static pods based on the behavior you want if you experience network issues or power loss. In addition, you can use Kubernetes zones and tolerations to control or avoid pod evictions if the control plane cannot reach remote worker nodes.
- Daemon sets
-
Daemon sets are the best approach to managing pods on remote worker nodes for the following reasons:
-
Daemon sets do not typically need rescheduling behavior. If a node disconnects from the cluster, pods on the node can continue to run. OpenShift Container Platform does not change the state of daemon set pods, and leaves the pods in the state they last reported. For example, if a daemon set pod is in the
Runningstate, when a node stops communicating, the pod keeps running and is assumed to be running by OpenShift Container Platform. -
Daemon set pods, by default, are created with
NoExecutetolerations for thenode.kubernetes.io/unreachableandnode.kubernetes.io/not-readytaints with notolerationSecondsvalue, as shown in the following example. These default values ensure that daemon set pods are never evicted if the control plane cannot reach a node.Tolerations added to daemon set pods by defaulttolerations: - key: node.kubernetes.io/not-ready operator: Exists effect: NoExecute - key: node.kubernetes.io/unreachable operator: Exists effect: NoExecute - key: node.kubernetes.io/disk-pressure operator: Exists effect: NoSchedule - key: node.kubernetes.io/memory-pressure operator: Exists effect: NoSchedule - key: node.kubernetes.io/pid-pressure operator: Exists effect: NoSchedule - key: node.kubernetes.io/unschedulable operator: Exists effect: NoSchedule -
Daemon sets can use labels to ensure that a workload runs on a matching worker node.
-
You can use an OpenShift Container Platform service endpoint to load balance daemon set pods.
Daemon sets do not schedule pods after a reboot of the node if OpenShift Container Platform cannot reach the node.
-
- Static pods
-
If you want pods to restart if a node reboots, such as after a power loss, you might use static pods. The kubelet on a node automatically restarts static pods as the node restarts.
Static pods cannot use secrets and config maps.
- Kubernetes zones
-
Kubernetes zones can slow down the rate or, in some cases, completely stop pod evictions.
When the control plane cannot reach a node, the node controller, by default, applies
node.kubernetes.io/unreachabletaints and evicts pods at a rate of 0.1 nodes per second. However, in a cluster that uses Kubernetes zones, pod eviction behavior is altered.If a zone is fully disrupted, where all nodes in the zone have a
FalseorUnknownready condition, the control plane does not apply thenode.kubernetes.io/unreachabletaint to the nodes in that zone.For partially disrupted zones, where more than 55% of the nodes have a
FalseorUnknowncondition, the pod eviction rate is reduced to 0.01 nodes per second. Nodes in smaller clusters, with fewer than 50 nodes, are not tainted. Your cluster must have more than three zones for these behavior to take effect.You assign a node to a specific zone by applying the
topology.kubernetes.io/regionlabel in the node specification.Sample node labels for Kubernetes zoneskind: Node apiVersion: v1 metadata: labels: topology.kubernetes.io/region=east
- Kubelet config objects
-
You can adjust the amount of time that the kubelet checks the state of each node.
To set the interval that affects the timing of when the on-premise node controller marks nodes with the
UnhealthyorUnreachablecondition, create aKubeletConfigobject that contains thenode-status-update-frequencyandnode-status-report-frequencyparameters.The kubelet on each node determines the node status as defined by the
node-status-update-frequencysetting and reports that status to the cluster based on thenode-status-report-frequencysetting. By default, the kubelet determines the pod status every 10 seconds and reports the status every minute. However, if the node state changes, the kubelet reports the change to the cluster immediately. OpenShift Container Platform uses thenode-status-report-frequencysetting only when the Node Lease feature gate is enabled, which is the default state in OpenShift Container Platform clusters. If the Node Lease feature gate is disabled, the node reports its status based on thenode-status-update-frequencysetting.Example kubelet configapiVersion: machineconfiguration.openshift.io/v1 kind: KubeletConfig metadata: name: disable-cpu-units spec: machineConfigPoolSelector: matchLabels: machineconfiguration.openshift.io/role: worker kubeletConfig: node-status-update-frequency: - "10s" node-status-report-frequency: - "1m"where:
spec.machineConfigPoolSelector.matchLabels.machineconfiguration.openshift.io/role-
Specifies the type of node type to which this
KubeletConfigobject applies by using the label from theMachineConfigobject. spec.kubeletConfig.node-status-update-frequency-
Specifies the frequency that the kubelet checks the status of a node associated with this
MachineConfigobject. The default value is10s. If you change this default, thenode-status-report-frequencyvalue is changed to the same value. spec.kubeletConfig.node-status-report-frequency-
Specifies the frequency that the kubelet reports the status of a node associated with this
MachineConfigobject. The default value is1m.
The
node-status-update-frequencyparameter works with thenode-monitor-grace-periodparameter.The
node-monitor-grace-periodparameter specifies how long OpenShift Container Platform waits after a node associated with aMachineConfigobject is markedUnhealthyif the controller manager does not receive the node heartbeat. Workloads on the node continue to run after this time. If the remote worker node rejoins the cluster afternode-monitor-grace-periodexpires, pods continue to run. New pods can be scheduled to that node. Thenode-monitor-grace-periodinterval is40s. Thenode-status-update-frequencyvalue must be lower than thenode-monitor-grace-periodvalue.Modifying the
node-monitor-grace-periodparameter is not supported.
- Tolerations
-
You can use pod tolerations to mitigate the effects if the on-premise node controller adds a
node.kubernetes.io/unreachabletaint with aNoExecuteeffect to a node it cannot reach.A taint with the
NoExecuteeffect affects pods that are running on the node in the following ways:-
Pods that do not tolerate the taint are queued for eviction.
-
Pods that tolerate the taint without specifying a
tolerationSecondsvalue in their toleration specification remain bound forever. -
Pods that tolerate the taint with a specified
tolerationSecondsvalue remain bound for the specified amount of time. After the time elapses, the pods are queued for eviction.Unless tolerations are explicitly set, Kubernetes automatically adds a toleration for
node.kubernetes.io/not-readyandnode.kubernetes.io/unreachablewithtolerationSeconds=300, meaning that pods remain bound for 5 minutes if either of these taints is detected.You can delay or avoid pod eviction by configuring pods tolerations with the
NoExecuteeffect for thenode.kubernetes.io/unreachableandnode.kubernetes.io/not-readytaints.Example toleration in a pod spec... tolerations: - key: "node.kubernetes.io/unreachable" operator: "Exists" effect: "NoExecute" - key: "node.kubernetes.io/not-ready" operator: "Exists" effect: "NoExecute" tolerationSeconds: 600 ...-
In the first example, the
NoExecuteeffect withouttolerationSecondslets pods remain forever if the control plane cannot reach the node. -
In the second example, the
NoExecuteeffect withtolerationSeconds: 600 lets pods remain for 10 minutes if the control plane marks the node asUnhealthy. You can specify your owntolerationSecondsvalue.
-
-
- Other types of OpenShift Container Platform objects
-
You can use replica sets, deployments, and replication controllers. The scheduler can reschedule these pods onto other nodes after the node is disconnected for five minutes. Rescheduling onto other nodes can be beneficial for some workloads, such as REST APIs, where an administrator can guarantee a specific number of pods are running and accessible.
When working with remote worker nodes, rescheduling pods on different nodes might not be acceptable if remote worker nodes are intended to be reserved for specific functions.
stateful sets do not get restarted when there is an outage. The pods remain in the
terminatingstate until the control plane can acknowledge that the pods are terminated.To avoid scheduling a to a node that does not have access to the same type of persistent storage, OpenShift Container Platform cannot migrate pods that require persistent volumes to other zones in the case of network separation.