Use the MigrationPolicy
custom resource definition (CRD) to define migration policies for one or more groups of selected virtual machine instances (VMIs).
You can specify groups of VMIs by using any combination of the following:
-
Virtual machine instance labels such as size
, os
, gpu
, and other VMI labels.
-
Namespace labels such as priority
, bandwidth
, hpc-workload
, and other namespace labels.
For the policy to apply to a specific group of VMIs, all labels on the group of VMIs must match the labels in the policy.
|
If multiple live migration policies apply to a VMI, the policy with the highest number of matching labels takes precedence. If multiple policies meet this criteria, the policies are sorted by lexicographic order of the matching labels keys, and the first one in that order takes precedence.
|
Procedure
-
Create a MigrationPolicy
CRD for your specified group of VMIs. The following example YAML configures a group with the labels hpc-workloads:true
, xyz-workloads-type: ""
, workload-type: db
, and operating-system: ""
:
apiVersion: migrations.kubevirt.io/v1beta1
kind: MigrationPolicy
metadata:
name: my-awesome-policy
spec:
# Migration Configuration
allowAutoConverge: true
bandwidthPerMigration: 217Ki
completionTimeoutPerGiB: 23
allowPostCopy: false
# Matching to VMIs
selectors:
namespaceSelector: (1)
hpc-workloads: "True"
xyz-workloads-type: ""
virtualMachineInstanceSelector: (2)
workload-type: "db"
operating-system: ""
1 |
Use namespaceSelector to define a group of VMIs by using namespace labels. |
2 |
Use virtualMachineInstanceSelector to define a group of VMIs by using VMI labels. |