$ oc get mcp worker -o jsonpath='{.spec.maxUnavailable}'
You can configure worker node batching to control how many worker nodes update simultaneously and how workloads tolerate disruption during cluster updates by using MachineConfigPool and PodDisruptionBudget resources.
You can configure the MachineConfigPool resource to control how many worker nodes update simultaneously during a cluster update.
Adjusting the maxUnavailable setting balances update speed against workload availability.
You have access to the target cluster with cluster-admin privileges.
The oc CLI tool is installed and configured.
Check the current maxUnavailable setting for the worker MachineConfigPool resource by running the following command:
$ oc get mcp worker -o jsonpath='{.spec.maxUnavailable}'
Set the required maxUnavailable value in the worker MachineConfigPool resource by running the following command:
$ oc patch mcp worker --type merge -p '{"spec":{"maxUnavailable":"<max_unavailable>"}}'
where <max_unavailable> is one of the following values:
An integer, for example 1, to specify the exact number of nodes that can be unavailable during the update.
A percentage, for example "50%", to specify the proportion of nodes that can be unavailable.
|
The default |
Verify the updated setting by running the following command:
$ oc get mcp worker -o yaml
Verify the MachineConfigPool resource reflects the updated maxUnavailable value by running the following command:
$ oc get mcp worker -o jsonpath='{.spec.maxUnavailable}'
You can configure PodDisruptionBudget resources to control how your workloads tolerate node draining during cluster updates.
Pod disruption budgets ensure that a minimum number of pod replicas remain available during worker node updates.
You have access to the target cluster with cluster-admin privileges.
The oc CLI tool is installed and configured.
You have identified critical workloads that run with replicas.
Create a PodDisruptionBudget resource for each critical workload:
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: <pdb_name>
namespace: <namespace>
spec:
maxUnavailable: 1
selector:
matchLabels:
app: <app_label>
where:
<pdb_name>: Specifies a name for the PodDisruptionBudget resource, for example cnf-workload-pdb.
<namespace>: Specifies the namespace where the workload runs, for example cnf-workload.
maxUnavailable: Specifies the maximum number of pods that can be unavailable during a disruption. Set this value to at least 1 to allow node draining to proceed.
<app_label>: Specifies the label selector that matches the pods for this workload.
Apply the PodDisruptionBudget resource by running the following command:
$ oc apply -f <pdb_filename>.yaml
Verify that the pod disruption budget allows at least one disruption by running the following command:
$ oc get pdb <pdb_name> -n <namespace>
The following example shows the output:
NAME MIN AVAILABLE MAX UNAVAILABLE ALLOWED DISRUPTIONS AGE
cnf-workload-pdb N/A 1 1 30s
|
Ensure the |
Repeat steps 1-3 for all critical workloads in your cluster.
Verify all pod disruption budgets across the cluster by running the following command:
$ oc get pdb -A
Verify that no pod disruption budgets are blocking disruptions by running the following command:
$ oc get pdb -A -o jsonpath='{range .items[?(@.status.disruptionsAllowed==0)]}{.metadata.namespace}{"\t"}{.metadata.name}{"\n"}{end}'
This command must produce no output. If the output lists any pod disruption budgets, adjust their configuration before updating.