apiVersion: kubevirt.io/v1
kind: VirtualMachineInstanceMigration
metadata:
name: migration-job
spec:
vmiName: vmi-fedora
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. |
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. |
In the OKD console, click Virtualization → VirtualMachines from the side menu.
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 next to the virtual machine and select Migrate.
click the virtual machine name to open the VirtualMachine details page and click Actions → Migrate.
click Migrate to migrate the virtual machine to another node.
You can monitor the progress of all live migrations on the Overview → Migrations tab in the web console.
You can view the migration metrics of a virtual machine on the VirtualMachine details → Metrics tab in the web console.
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.
Create a VirtualMachineInstanceMigration
configuration file for the virtual machine instance to migrate. For example, vmi-migrate.yaml
:
apiVersion: kubevirt.io/v1
kind: VirtualMachineInstanceMigration
metadata:
name: migration-job
spec:
vmiName: vmi-fedora
Create the object in the cluster by running the following command:
$ 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.
The status of the virtual machine migration is stored in the Status
component of the VirtualMachineInstance
configuration.
Use the oc describe
command on the migrating virtual machine instance:
$ oc describe vmi vmi-fedora
# ...
Status:
Conditions:
Last Probe Time: <nil>
Last Transition Time: <nil>
Status: True
Type: LiveMigratable
Migration Method: LiveMigration
Migration State:
Completed: true
End Timestamp: 2018-12-24T06:19:42Z
Migration UID: d78c8962-0743-11e9-a540-fa163e0c69f1
Source Node: node2.example.com
Start Timestamp: 2018-12-24T06:19:35Z
Target Node: node1.example.com
Target Node Address: 10.9.0.18:43891
Target Node Domain Detected: true