|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * hosted_control_planes/hcp-manage/hcp-manage-virt.adoc |
| 4 | + |
| 5 | +:_mod-docs-content-type: PROCEDURE |
| 6 | +[id="hcp-topology-spread-constraint_{context}"] |
| 7 | += Spreading node pool VMs by using topologySpreadConstraint |
| 8 | + |
| 9 | +By default, KubeVirt virtual machines (VMs) created by a node pool are scheduled on any available nodes that have the capacity to run the VMs. By default, the `topologySpreadConstraint` constraint is set to schedule VMs on multiple nodes. |
| 10 | + |
| 11 | +In some scenarios, node pool 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. |
| 12 | + |
| 13 | +.Prerequisites |
| 14 | + |
| 15 | +* You installed the {descheduler-operator}. For more information, see "Installing the descheduler". |
| 16 | +
|
| 17 | +.Procedure |
| 18 | + |
| 19 | +* Open the `KubeDescheduler` custom resource (CR) by entering the following command, and then modify the `KubeDescheduler` CR to use the `SoftTopologyAndDuplicates` and `DevKubeVirtRelieveAndMigrate` profiles so that you maintain the `topologySpreadConstraint` constraint settings. |
| 20 | ++ |
| 21 | +The `KubeDescheduler` CR named `cluster` runs in the `openshift-kube-descheduler-operator` namespace. |
| 22 | ++ |
| 23 | +[source,terminal] |
| 24 | +---- |
| 25 | +$ oc edit kubedescheduler cluster -n openshift-kube-descheduler-operator |
| 26 | +---- |
| 27 | ++ |
| 28 | +.Example `KubeDescheduler` configuration |
| 29 | +[source,yaml] |
| 30 | +---- |
| 31 | +apiVersion: operator.openshift.io/v1 |
| 32 | +kind: KubeDescheduler |
| 33 | +metadata: |
| 34 | + name: cluster |
| 35 | + namespace: openshift-kube-descheduler-operator |
| 36 | +spec: |
| 37 | + mode: Automatic |
| 38 | + managementState: Managed |
| 39 | + deschedulingIntervalSeconds: 30 # <1> |
| 40 | + profiles: |
| 41 | + - SoftTopologyAndDuplicates # <2> |
| 42 | + - DevKubeVirtRelieveAndMigrate # <3> |
| 43 | + profileCustomizations: |
| 44 | + devDeviationThresholds: AsymmetricLow |
| 45 | + devActualUtilizationProfile: PrometheusCPUCombined |
| 46 | +# ... |
| 47 | +---- |
| 48 | +<1> Sets the number of seconds between the descheduler running cycles. |
| 49 | +<2> This profile evicts pods that follow the soft topology constraint: `whenUnsatisfiable: ScheduleAnyway`. |
| 50 | +<3> This profile balances resource usage between nodes and enables the strategies, such as `RemovePodsHavingTooManyRestarts` and `LowNodeUtilization`. |
0 commit comments