mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// virt/live_migration/virt-configuring-live-migration.adoc
|
|
|
|
:_mod-docs-content-type: PROCEDURE
|
|
[id="virt-migrate-vm-to-labeled-node_{context}"]
|
|
= Migrating a VM to a specific node
|
|
|
|
[role="_abstract"]
|
|
You can migrate a running virtual machine (VM) to a specific subset of nodes by using the `addedNodeSelector` field on the `VirtualMachineInstanceMigration` object.
|
|
|
|
The `addedNodeSelector` field lets you apply additional node selection rules for a *one-time* migration attempt, without affecting the VM configuration or future migrations.
|
|
|
|
.Prerequisites
|
|
|
|
* You have access to the cluster as a user with the `cluster-admin` role.
|
|
* The VM you want to migrate is running.
|
|
* You have identified the labels of the target nodes. Multiple labels can be specified and are combined with logical `AND`.
|
|
* The `oc` CLI tool is installed.
|
|
|
|
.Procedure
|
|
|
|
. Create a migration manifest YAML file. For example:
|
|
+
|
|
[source,yaml]
|
|
----
|
|
apiVersion: kubevirt.io/v1
|
|
kind: VirtualMachineInstanceMigration
|
|
metadata:
|
|
name: migration-job
|
|
spec:
|
|
vmiName: vmi-fedora
|
|
addedNodeSelector:
|
|
accelerator: gpu-enabled23
|
|
kubernetes.io/hostname: "ip-172-28-114-199.example"
|
|
----
|
|
+
|
|
|
|
where:
|
|
|
|
`vmiName`:: Specifies the name of the running VM (for example, `vmi-fedora`).
|
|
`addedNodeSelector`:: Specifies additional constraints for selecting the target node.
|
|
|
|
. Apply the manifest to the cluster by running the following command:
|
|
+
|
|
[source,terminal]
|
|
----
|
|
$ oc apply -f <file_name>.yaml
|
|
----
|
|
+
|
|
If no nodes satisfy the constraints, the migration is declared a failure after a timeout. The VM remains unaffected.
|