1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-07 00:48:01 +01:00
Files
openshift-docs/modules/virt-vm-custom-scheduler.adoc
2024-04-10 20:26:45 +00:00

78 lines
2.0 KiB
Plaintext

// Module included in the following assemblies:
//
// * virt/virtual_machines/advanced_vm_management/virt-schedule-vms.adoc
:_mod-docs-content-type: PROCEDURE
[id="virt-vm-custom-scheduler_{context}"]
= Scheduling virtual machines with a custom scheduler
You can use a custom scheduler to schedule a virtual machine (VM) on a node.
.Prerequisites
* A secondary scheduler is configured for your cluster.
.Procedure
* Add the custom scheduler to the VM configuration by editing the `VirtualMachine` manifest. For example:
+
[source,yaml]
----
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
name: vm-fedora
spec:
running: true
template:
spec:
schedulerName: my-scheduler <1>
domain:
devices:
disks:
- name: containerdisk
disk:
bus: virtio
# ...
----
<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.
.Verification
* Verify that the VM is using the custom scheduler specified in the `VirtualMachine` manifest by checking the `virt-launcher` pod events:
.. View the list of pods in your cluster by entering the following command:
+
[source,terminal]
----
$ oc get pods
----
+
.Example output
[source,terminal]
----
NAME READY STATUS RESTARTS AGE
virt-launcher-vm-fedora-dpc87 2/2 Running 0 24m
----
.. Run the following command to display the pod events:
+
[source,terminal]
----
$ oc describe pod virt-launcher-vm-fedora-dpc87
----
+
The value of the `From` field in the output verifies that the scheduler name matches the custom scheduler specified in the `VirtualMachine` manifest:
+
.Example output
[source,terminal]
----
[...]
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 21m my-scheduler Successfully assigned default/virt-launcher-vm-fedora-dpc87 to node01
[...]
----