Skip to content

Commit ce2e39f

Browse files
committed
[OSDOCS-16009]: Adding evictionStrategy docs
1 parent e913d0f commit ce2e39f

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

hosted_control_planes/hcp-manage/hcp-manage-virt.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ include::modules/hcp-virt-attach-nvidia-gpus.adoc[leveloffset=+1]
6060

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

63+
include::modules/hcp-virt-evict-vms.adoc[leveloffset=+1]
64+
6365
include::modules/hcp-topology-spread-constraint.adoc[leveloffset=+1]
6466

6567
[role="_additional-resources"]

modules/hcp-virt-evict-vms.adoc

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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-virt-evict-vms_{context}"]
7+
= Evicting KubeVirt virtual machines
8+
9+
In cases where KubeVirt virtual machines (VMs) cannot be live migrated, such as when you use GPU passthrough, the VMs must be evicted at the same time as the `NodePool` resource of the hosted cluster. Otherwise, the compute nodes might be shut down without being drained from the workload. This might also happen when you are upgrading the {VirtProductName} Operator. To achieve a synchronized restart, you can set the `evictionStrategy` parameter on the `hyperconverged` resource to ensure that only VMs that are drained from workloads are rebooted.
10+
11+
.Procedure
12+
13+
. Enter the following command:
14+
+
15+
[source,terminal]
16+
----
17+
$ oc explain hyperconverged.spec.evictionStrategy
18+
----
19+
+
20+
.Example output
21+
[source,terminal]
22+
----
23+
GROUP: hco.kubevirt.io
24+
KIND: HyperConverged
25+
VERSION: v1beta1FIELD: evictionStrategy <string>
26+
ENUM:
27+
None
28+
LiveMigrate
29+
LiveMigrateIfPossible
30+
External
31+
DESCRIPTION:
32+
EvictionStrategy defines at the cluster level if the VirtualMachineInstance
33+
should be
34+
migrated instead of shut-off in case of a node drain. If the
35+
VirtualMachineInstance specific
36+
field is set it overrides the cluster level one.
37+
Allowed values:
38+
- `None` no eviction strategy at cluster level.
39+
- `LiveMigrate` migrate the VM on eviction; a not live migratable VM with no
40+
specific strategy will block the drain of the node util manually evicted.
41+
- `LiveMigrateIfPossible` migrate the VM on eviction if live migration is
42+
possible, otherwise directly evict.
43+
- `External` block the drain, track eviction and notify an external
44+
controller.
45+
Defaults to LiveMigrate with multiple worker nodes, None on single worker
46+
clusters.
47+
----
48+
49+
. Patch the `hyperconverged` resource by entering the following command:
50+
+
51+
[source,terminal]
52+
----
53+
$ oc -n openshift-cnv patch hyperconverged kubevirt-hyperconverged \
54+
--type=merge \
55+
-p '{"spec": {"evictionStrategy": "External"}}'
56+
----
57+
58+
. Patch the workload update strategy and the workload update methods by entering the following command:
59+
+
60+
[source,terminal]
61+
----
62+
$ oc -n openshift-cnv patch hyperconverged kubevirt-hyperconverged \
63+
--type=merge \
64+
-p '{"spec": {"workloadUpdateStrategy": {"workloadUpdateMethods": ["LiveMigrate","Evict"]}}}'
65+
----
66+
+
67+
Patching to `LiveMigrate` and `Evict` should live migrate VMs if possible and only evict VMs that are not able to be live migrated.
68+
69+
.Verification
70+
71+
* Check whether the patch command was applied properly by entering the following command:
72+
+
73+
[source,terminal]
74+
----
75+
$ oc -n openshift-cnv get hyperconverged kubevirt-hyperconverged -ojsonpath='{.spec.evictionStrategy}'
76+
----
77+
+
78+
.Example output
79+
[source,terminal]
80+
----
81+
External
82+
----

0 commit comments

Comments
 (0)