Chapter 5. Managing the hosting cluster for virtualized control planes
After deploying virtualized control plane clusters, you must manage the hosting cluster to maintain the availability and performance of the target clusters it supports.
5.1. Overview of hosting cluster management Copy linkLink copied to clipboard!
A hosting cluster that runs virtualized control plane VMs requires ongoing management to maintain the availability and performance of all target clusters it supports.
Hosting cluster management includes the following tasks:
- Updating the hosting cluster and OpenShift Virtualization without disrupting the target clusters.
-
Performing node maintenance on hosting cluster nodes while preserving
etcdquorum in target clusters.
Because multiple target clusters can share the same hosting cluster, a misconfigured update or unplanned maintenance event on the hosting cluster can affect multiple target clusters simultaneously. Plan and execute all hosting cluster operations with awareness of which target cluster VMs run on which physical nodes.
5.2. Update a hosting cluster for virtualized control planes Copy linkLink copied to clipboard!
Update the hosting cluster and OpenShift Virtualization while maintaining the availability of the target clusters.
During a hosting cluster update, the Machine Config Operator drains and reboots nodes one at a time. If pod disruption budgets and anti-affinity rules are configured correctly, the update proceeds without losing etcd quorum in any target cluster.
Prerequisites
- Control plane VMs are distributed across hosting cluster nodes by using anti-affinity rules.
-
A
PodDisruptionBudgetwithminAvailable: 2is configured for each target cluster’s control plane VMs. -
The VM eviction strategy is set to
Nonefor all control plane VMs.
Procedure
Verify that all target cluster control plane VMs are healthy before starting the update by running the following command:
$ oc get vm -A -l <vm_selector_label>=<value>Replace
<vm_selector_label>=<value>with the label you configured in your KubeVirt Redfishvm_selector, for exampleredfish-enabled=true.All control plane VMs must show a
Runningstatus.Verify
etcdhealth on each target cluster by running the following command:$ oc --kubeconfig=<target_cluster_kubeconfig> get etcd -o=jsonpath='{range .items[0].status.conditions[?(@.type=="EtcdMembersAvailable")]}{.message}{end}'-
target_cluster_kubeconfigis the path to the target cluster’s kubeconfig file.
-
Start the hosting cluster update by following the standard OpenShift Container Platform update process.
The Machine Config Operator drains and reboots each node in sequence. The
PodDisruptionBudgetCR prevents more than one control plane VM for each target cluster from being evicted at a time.Monitor the update progress by running the following commands:
$ oc get clusterversion $ oc get nodes- After the hosting cluster update completes, update OpenShift Virtualization if a new version is available.
Verify that all control plane VMs are running after the update by running the following command:
$ oc get vm -A -l <vm_selector_label>=<value>Replace
<vm_selector_label>=<value>with the label you configured in your KubeVirt Redfishvm_selector, for exampleredfish-enabled=true.All control plane VMs must show a
Runningstatus.
Verification
Verify
etcdhealth on each target cluster after the update by running the following command:$ oc --kubeconfig=<target_cluster_kubeconfig> get etcd -o=jsonpath='{range .items[0].status.conditions[?(@.type=="EtcdMembersAvailable")]}{.message}{end}'-
target_cluster_kubeconfigis the path to the target cluster’s kubeconfig file.
-
Verify that the target cluster API is responsive by running the following command:
$ oc --kubeconfig=<target_cluster_kubeconfig> get nodes-
target_cluster_kubeconfigis the path to the target cluster’s kubeconfig file.
-
5.3. Performing node maintenance on a hosting cluster Copy linkLink copied to clipboard!
Perform maintenance on a hosting cluster node, such as applying operating system updates or hardware repairs, without disrupting the target clusters.
When you drain a hosting cluster node, the control plane VM on that node shuts down. If pod disruption budgets and anti-affinity rules are configured correctly, only one control plane VM for each target cluster is affected, and etcd quorum is preserved.
Prerequisites
- Control plane VMs are distributed across hosting cluster nodes by using anti-affinity rules.
-
A
PodDisruptionBudgetwithminAvailable: 2is configured for each target cluster’s control plane VMs. -
The VM eviction strategy is set to
Nonefor all control plane VMs.
Procedure
Identify which control plane VMs are running on the node you plan to maintain by running the following command:
$ oc get pods --field-selector spec.nodeName=<node_name> -n <vm_namespace> -l vcp-cluster=<cluster_name>-
<node_name>is the name of the node you plan to maintain. -
<vm_namespace>is the namespace of the control plane VMs. <cluster_name>is the name of the target cluster.NoteUse
oc get podswith thespec.nodeNamefield selector to filter by node. Theoc get vmicommand does not support thestatus.nodeNamefield selector.
-
Verify that all target clusters affected by this node have healthy
etcdquorum before proceeding by running the following command:$ oc --kubeconfig=<target_cluster_kubeconfig> get etcd -o=jsonpath='{range .items[0].status.conditions[?(@.type=="EtcdMembersAvailable")]}{.message}{end}'-
target_cluster_kubeconfigis the path to the target cluster’s kubeconfig file.
-
Cordon the node to prevent new workloads from being scheduled by running the following command:
$ oc adm cordon <node_name>-
<node_name>is the name of the node you plan to maintain.
-
Drain the node to evict all pods, including control plane VM pods, by running the following command:
$ oc adm drain <node_name> --ignore-daemonsets --delete-emptydir-data<node_name>is the name of the node you plan to maintain.The
PodDisruptionBudgetensures that only one control plane VM per target cluster is evicted. The drain operation blocks until the PDB allows eviction.
Verify that the remaining control plane VMs maintain
etcdquorum on each affected target cluster by running the following command:$ oc --kubeconfig=<target_cluster_kubeconfig> get etcd -o=jsonpath='{range .items[0].status.conditions[?(@.type=="EtcdMembersAvailable")]}{.message}{end}'-
target_cluster_kubeconfigis the path to the target cluster’s kubeconfig file.
-
- Perform the required maintenance on the physical node.
Uncordon the node to allow workloads to be scheduled again by running the following command:
$ oc adm uncordon <node_name>-
<node_name>is the name of the node you plan to maintain.
-
Verify that the control plane VM restarts on the node and rejoins the target cluster by running the following command:
$ oc get vmi -A -l <vm_selector_label>=<value>Replace
<vm_selector_label>=<value>with the label you configured in your KubeVirt Redfishvm_selector, for exampleredfish-enabled=true.All control plane VMs must show a
Runningphase.NoteUse
oc get vmi(VirtualMachineInstance) instead ofoc get vm(VirtualMachine) to verify the actual runtime state. TheVirtualMachineresource reflects the desired state, while theVirtualMachineInstanceresource reflects whether the VM is currently running.
Verification
Verify
etcdhealth on each affected target cluster by running the following command:$ oc --kubeconfig=<target_cluster_kubeconfig> get etcd -o=jsonpath='{range .items[0].status.conditions[?(@.type=="EtcdMembersAvailable")]}{.message}{end}'-
target_cluster_kubeconfigis the path to the target cluster’s kubeconfig file.
-