Skip to content

Commit 6de2f98

Browse files
author
Shikha Jhala
committed
CNV-21645: Custom scheduler for VMs
1 parent 3bc5587 commit 6de2f98

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

modules/virt-vm-custom-scheduler.adoc

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * virt/virtual_machines/advanced_vm_management/virt-schedule-vms.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="virt-vm-custom-scheduler_{context}"]
7+
= Scheduling virtual machines with a custom scheduler
8+
9+
You can use a custom scheduler to schedule a virtual machine (VM) on a node.
10+
11+
.Prerequisites
12+
* A secondary scheduler is configured for your cluster.
13+
14+
.Procedure
15+
16+
* Add the custom scheduler to the VM configuration by editing the `VirtualMachine` manifest. For example:
17+
+
18+
[source,yaml]
19+
----
20+
apiVersion: kubevirt.io/v1
21+
kind: VirtualMachine
22+
metadata:
23+
name: vm-fedora
24+
spec:
25+
running: true
26+
template:
27+
spec:
28+
schedulerName: my-scheduler <1>
29+
domain:
30+
devices:
31+
disks:
32+
- name: containerdisk
33+
disk:
34+
bus: virtio
35+
# ...
36+
----
37+
<1> The name of the custom scheduler. If the `schedulerName` value does not match an existing scheduler, the `virt-launcher` pod stays in a `Pending` state until the specified scheduler is found.
38+
39+
40+
.Verification
41+
* Verify that the VM is using the custom scheduler specified in the `VirtualMachine` manifest by checking the `virt-launcher` pod events:
42+
.. View the list of pods in your cluster by entering the following command:
43+
+
44+
[source,terminal]
45+
----
46+
$ oc get pods
47+
----
48+
+
49+
.Example output
50+
[source,terminal]
51+
----
52+
NAME READY STATUS RESTARTS AGE
53+
virt-launcher-vm-fedora-dpc87 2/2 Running 0 24m
54+
----
55+
56+
.. Run the following command to display the pod events:
57+
+
58+
[source,terminal]
59+
----
60+
$ oc describe pod virt-launcher-vm-fedora-dpc87
61+
----
62+
+
63+
The value of the `From` field in the output verifies that the scheduler name matches the custom scheduler specified in the `VirtualMachine` manifest:
64+
+
65+
.Example output
66+
[source,terminal]
67+
----
68+
[...]
69+
Events:
70+
Type Reason Age From Message
71+
---- ------ ---- ---- -------
72+
Normal Scheduled 21m my-scheduler Successfully assigned default/virt-launcher-vm-fedora-dpc87 to node01
73+
[...]
74+
----
75+

virt/virtual_machines/advanced_vm_management/virt-schedule-vms.adoc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ toc::[]
99
You can schedule a virtual machine (VM) on a node by ensuring that the VM's CPU model and policy attribute are matched for compatibility with the CPU models and policy attributes supported by the node.
1010

1111
include::modules/virt-policy-attributes.adoc[leveloffset=+1]
12+
1213
include::modules/virt-setting-policy-attributes.adoc[leveloffset=+1]
14+
1315
include::modules/virt-schedule-supported-cpu-model-vms.adoc[leveloffset=+1]
16+
1417
include::modules/virt-schedule-cpu-host-model-vms.adoc[leveloffset=+1]
18+
19+
include::modules/virt-vm-custom-scheduler.adoc[leveloffset=+1]
20+
21+
[role="_additional-resources"]
22+
.Additional resources
23+
* xref:../../../nodes/scheduling/secondary_scheduler/nodes-secondary-scheduler-configuring.adoc#nodes-secondary-scheduler-configuring-console_secondary-scheduler-configuring[Deploying a secondary scheduler]

0 commit comments

Comments
 (0)