Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hosted_control_planes/hcp-manage/hcp-manage-virt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,10 @@ include::modules/hcp-virt-etcd-storage.adoc[leveloffset=+2]
include::modules/hcp-virt-attach-nvidia-gpus.adoc[leveloffset=+1]

include::modules/hcp-virt-attach-nvidia-gpus-np-api.adoc[leveloffset=+1]

include::modules/hcp-topology-spread-constraint.adoc[leveloffset=+1]

[role="_additional-resources"]
.Additional resources

* xref:../../nodes/scheduling/descheduler/nodes-descheduler-configuring.adoc#nodes-descheduler-installing_virt-enabling-descheduler-evictions[Installing the descheduler]
50 changes: 50 additions & 0 deletions modules/hcp-topology-spread-constraint.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Module included in the following assemblies:
//
// * hosted_control_planes/hcp-manage/hcp-manage-virt.adoc

:_mod-docs-content-type: PROCEDURE
[id="hcp-topology-spread-constraint_{context}"]
= Spreading node pool VMs by using topologySpreadConstraint

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.

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.

.Prerequisites

* You installed the {descheduler-operator}. For more information, see "Installing the descheduler".

.Procedure

* 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.
+
The `KubeDescheduler` CR named `cluster` runs in the `openshift-kube-descheduler-operator` namespace.
+
[source,terminal]
----
$ oc edit kubedescheduler cluster -n openshift-kube-descheduler-operator
----
+
.Example `KubeDescheduler` configuration
[source,yaml]
----
apiVersion: operator.openshift.io/v1
kind: KubeDescheduler
metadata:
name: cluster
namespace: openshift-kube-descheduler-operator
spec:
mode: Automatic
managementState: Managed
deschedulingIntervalSeconds: 30 # <1>
profiles:
- SoftTopologyAndDuplicates # <2>
- DevKubeVirtRelieveAndMigrate # <3>
profileCustomizations:
devDeviationThresholds: AsymmetricLow
devActualUtilizationProfile: PrometheusCPUCombined
# ...
----
<1> Sets the number of seconds between the descheduler running cycles.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to also comment out the callout lines? The preview looks good though.

Copy link
Contributor Author

@xenolinux xenolinux May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Added # for call outs

<2> This profile evicts pods that follow the soft topology constraint: `whenUnsatisfiable: ScheduleAnyway`.
<3> This profile balances resource usage between nodes and enables the strategies, such as `RemovePodsHavingTooManyRestarts` and `LowNodeUtilization`.