Follow the steps below to migrate virtual machines (VMs) to KubeVirt using the command line (CLI) by creating Forklift custom resources (CRs) and specifying:
Prerequisites
Must be logged in as a user with cluster-admin privileges.
VMware only:
Procedure
$ cat << EOF | kubectl apply -f -
apiVersion: v1
kind: Secret
metadata:
name: <secret>
namespace: konveyor-forklift
type: Opaque
stringData:
user: <user> (1)
password: <password> (2)
cacert: | (3)
<oVirt_ca_certificate>
thumbprint: <vcenter_fingerprint> (4)
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: Provider
metadata:
name: <provider>
namespace: konveyor-forklift
spec:
type: <provider_type> (1)
url: <api_end_point> (2)
settings:
vddkInitImage: <registry_route_or_server_path>/vddk: (3)
secret:
name: <secret> (4)
namespace: konveyor-forklift
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: Host
metadata:
name: <vmware_host>
namespace: konveyor-forklift
spec:
provider:
namespace: konveyor-forklift
name: <source_provider> (1)
id: <source_host_mor> (2)
ipAddress: <source_network_ip> (3)
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: NetworkMap
metadata:
name: <network_map>
namespace: konveyor-forklift
spec:
map:
- destination:
name: <pod>
namespace: konveyor-forklift
type: pod (1)
source: (2)
id: <source_network_id> (3)
name: <source_network_name>
- destination:
name: <network_attachment_definition> (4)
namespace: <network_attachment_definition_namespace> (5)
type: multus
source:
id: <source_network_id>
name: <source_network_name>
provider:
source:
name: <source_provider>
namespace: konveyor-forklift
destination:
name: <destination_cluster>
namespace: konveyor-forklift
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: StorageMap
metadata:
name: <storage_map>
namespace: konveyor-forklift
spec:
map:
- destination:
storageClass: <storage_class>
accessMode: <access_mode> (1)
source:
id: <source_datastore> (2)
- destination:
storageClass: <storage_class>
accessMode: <access_mode>
source:
id: <source_datastore>
provider:
source:
name: <source_provider>
namespace: konveyor-forklift
destination:
name: <destination_cluster>
namespace: konveyor-forklift
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: Hook
metadata:
name: <hook>
namespace: konveyor-forklift
spec:
image: quay.io/konveyor/hook-runner (1)
playbook: | (2)
LS0tCi0gbmFtZTogTWFpbgogIGhvc3RzOiBsb2NhbGhvc3QKICB0YXNrczoKICAtIG5hbWU6IExv
YWQgUGxhbgogICAgaW5jbHVkZV92YXJzOgogICAgICBmaWxlOiAiL3RtcC9ob29rL3BsYW4ueW1s
IgogICAgICBuYW1lOiBwbGFuCiAgLSBuYW1lOiBMb2FkIFdvcmtsb2FkCiAgICBpbmNsdWRlX3Zh
cnM6CiAgICAgIGZpbGU6ICIvdG1wL2hvb2svd29ya2xvYWQueW1sIgogICAgICBuYW1lOiB3b3Jr
bG9hZAoK
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: Plan
metadata:
name: <plan> (1)
namespace: konveyor-forklift
spec:
warm: true (2)
provider:
source:
name: <source_provider>
namespace: konveyor-forklift
destination:
name: <destination_cluster>
namespace: konveyor-forklift
map:
network: (3)
name: <network_map> (4)
namespace: konveyor-forklift
storage:
name: <storage_map> (5)
namespace: konveyor-forklift
targetNamespace: konveyor-forklift
vms: (6)
- id: <source_vm> (7)
- name: <source_vm>
hooks: (8)
- hook:
namespace: konveyor-forklift
name: <hook> (9)
step: <step> (10)
EOF
The explanations below refer to the callouts in the sample code above.
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: Migration
metadata:
name: <migration> (1)
namespace: konveyor-forklift
spec:
plan:
name: <plan> (2)
namespace: konveyor-forklift
cutover: <cutover_time> (3)
EOF
The explanations below refer to the callouts in the sample code above.
$ kubectl get migration/<migration> -n konveyor-forklift -o yaml
Obtain the SHA-1 fingerprint of a vCenter host in order to create a Secret CR.
Procedure
$ openssl s_client \
-connect <vcenter_host>:443 \ (1)
< /dev/null 2>/dev/null \
| openssl x509 -fingerprint -noout -in /dev/stdin \
| cut -d '=' -f 2
The explanation below refers to the callouts in the sample code above.
Example output:
01:23:45:67:89:AB:CD:EF:01:23:45:67:89:AB:CD:EF:01:23:45:67
Forklift functionality can cancel an entire migration or individual virtual machines (VMs) while a migration is in progress from the command line interface (CLI).
Follow the steps below to cancel an entire migration.
Procedure
$ kubectl delete migration <migration> -n konveyor-forklift (1)
The explanation below refers to the callouts in the sample code above.
Follow the steps below to cancel migrating an individual VM.
Procedure
$ cat << EOF | kubectl apply -f -
apiVersion: forklift.konveyor.io/v1beta1
kind: Migration
metadata:
name: <migration>
namespace: konveyor-forklift
...
spec:
cancel:
- id: vm-102 (1)
- id: vm-203
- name: rhel8-vm
EOF
The explanation below refers to the callouts in the sample code above.
$ kubectl get migration/<migration> -n konveyor-forklift -o yaml