Migrating a virtual machine instance to another node

Manually initiate a live migration of a virtual machine instance to another node using either the web console or the CLI.

If a virtual machine uses a host model CPU, you can perform live migration of that virtual machine only between nodes that support its host CPU model.

Initiating live migration of a virtual machine instance in the web console

Migrate a running virtual machine instance to a different node in the cluster.

The Migrate action is visible to all users but only admin users can initiate a virtual machine migration.

Procedure

  1. In the OKD console, click VirtualizationVirtualMachines from the side menu.

  2. You can initiate the migration from this page, which makes it easier to perform actions on multiple virtual machines on the same page, or from the VirtualMachine details page where you can view comprehensive details of the selected virtual machine:

    • Click the Options menu kebab next to the virtual machine and select Migrate.

    • Click the virtual machine name to open the VirtualMachine details page and click ActionsMigrate.

  3. Click Migrate to migrate the virtual machine to another node.

Initiating live migration of a virtual machine instance in the CLI

Initiate a live migration of a running virtual machine instance by creating a VirtualMachineInstanceMigration object in the cluster and referencing the name of the virtual machine instance.

Procedure

  1. Create a VirtualMachineInstanceMigration configuration file for the virtual machine instance to migrate. For example, vmi-migrate.yaml:

    1. apiVersion: kubevirt.io/v1
    2. kind: VirtualMachineInstanceMigration
    3. metadata:
    4. name: migration-job
    5. spec:
    6. vmiName: vmi-fedora
  2. Create the object in the cluster by running the following command:

    1. $ oc create -f vmi-migrate.yaml

The VirtualMachineInstanceMigration object triggers a live migration of the virtual machine instance. This object exists in the cluster for as long as the virtual machine instance is running, unless manually deleted.

Additional resources