Spreading node pool VMs by using topologySpreadConstraint
In some scenarios, node pool virtual machines (VMs) might run on the same node, which can cause availability issues. To avoid distribution of VMs on a single node, use the descheduler to continuously honor the topologySpreadConstraint constraint to spread VMs on multiple nodes.
By default, KubeVirt VMs created by a node pool are scheduled on any available nodes that have the capacity to run the VMs. The topologySpreadConstraint constraint is set to schedule VMs on multiple nodes.
-
You installed the Kube Descheduler Operator. For more information, see "Installing the descheduler".
-
Open the
KubeDeschedulercustom resource (CR) by entering the following command, and then modify theKubeDeschedulerCR to use theSoftTopologyAndDuplicatesandKubeVirtRelieveAndMigrateprofiles so that you maintain thetopologySpreadConstraintconstraint settings.The
KubeDeschedulerCR namedclusterruns in theopenshift-kube-descheduler-operatornamespace.$ oc edit kubedescheduler cluster -n openshift-kube-descheduler-operatorExampleKubeDeschedulerconfigurationapiVersion: operator.openshift.io/v1 kind: KubeDescheduler metadata: name: cluster namespace: openshift-kube-descheduler-operator spec: mode: Automatic managementState: Managed deschedulingIntervalSeconds: 30 profiles: - SoftTopologyAndDuplicates - KubeVirtRelieveAndMigrate profileCustomizations: devDeviationThresholds: AsymmetricLow devActualUtilizationProfile: PrometheusCPUCombined # ...where:
spec.deschedulingIntervalSeconds-
Sets the number of seconds between the descheduler running cycles.
spec.profiles-
The
SoftTopologyAndDuplicatesprofile evicts pods that follow thewhenUnsatisfiable: ScheduleAnywaysoft topology constraint. TheKubeVirtRelieveAndMigrateprofile balances resource usage between nodes and enables strategies, such asRemovePodsHavingTooManyRestartsandLowNodeUtilization.