In this topic, you will use Migrate for Anthos to migrate VMs from Compute Engine to containers running on Google Kubernetes Engine.
Migrating from Compute Engine to GKE has several crucial differences from VMware migrations.
Setting up a cluster to perform migrations is detailed at Configuring a GKE cluster.
Building configuration files
Open Cloud Shell or a terminal
Continue with installation
Install the required dependencies.
pip3 install --user pyyaml
Open the VM Instances page on the GCP Console and Stop the Compute Engine instance you are migrating.
clone_vm_disksscript to clone the VM's disks and generate a deployment YAML file:
python3 /google/migrate/anthos/gce-to-gke/clone_vm_disks.py \-p [PROJECT_NAME] `#Your GCP project name` \ -z [ZONE_NAME] `#GCP Zone that hosts the VM, for example us-central1-a` \ -i [VM_NAME] `#Name of the VM. For example, myapp-vm` \ -A [APP_NAME] `#Name of workload that will be launched in GKE` \ -o [YAML_FILE_NAME] `#Filename of resulting YAML configuration`
Apply configuration to your cluster
To apply the deployment to your cluster, run
kubectl apply -f [YAML_FILE_NAME]
Next, open the GKE Workloads page on the Google Cloud Platform Console. Check that your Workload is running on the cluster.
Your VM is now migrated to GKE.
Checking your container without SSH
You can open a shell prompt on a container using
First, find the name of the Pod in your cluster that you want to connect
to. In the example below, the
Name of the Pod is
kubectl describe pods | grep Name Name: suitecrm-0
Then, execute the
bash shell in an interactive prompt.
kubectl exec -it [POD_NAME] -- /bin/bash
For more information, see the Kubernetes documentation.