You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= 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
Copy file name to clipboardExpand all lines: virt/virtual_machines/advanced_vm_management/virt-schedule-vms.adoc
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,15 @@ toc::[]
9
9
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.
* 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