Adding a migration source
Before you start migrating, you create a migration source that represents the source platform from which you will be migrating. This source is added to your migration plan.
This topic describes how to create a source for each of the supported source platforms.
Before you begin
Migrate to Containers supplies a tool that you run on a VM workload to determine the workload's fit for migration to a container. For more information, see Using the fit assessment tool.
Complete the migration prerequisites specific to your migration environment.
Create a processing cluster specific to your migration environment.
Source naming requirements
You assign a name to a migration source when you add it to Migrate to Containers. The name must meet the following requirements:
- Contain at most 63 characters.
- Contain only lowercase alphanumeric characters or "-" (hyphen).
- Start with an alphanumeric character.
- End with an alphanumeric character.
Adding a migration source
Define the migration source you're migrating from by running the
migctl source create
command or by using
the Google Cloud console.
This process adds details needed to migrate from the
source you specify — VMware or Compute Engine.
migctl on Google Cloud
Compute Engine
Create a service account for using Compute Engine as a migration source and download the JSON key file, as described in Configuring a service account.
Create the source using the service account:
migctl source create ce SOURCE_NAME --project PROJECT_ID --json-key=COMPUTE_KEY.json
Replace the following:
- SOURCE_NAME: the name you want for your source
- PROJECT_ID: your project ID
- COMPUTE_KEY.json: the path of the service account json key used for the Compute Engine service
VMware
Create a service account and download the Compute Engine JSON key file, as described in Specify the Migrate to Virtual Machines target project service account.
Create a service account and download the Migrate to Virtual Machines JSON key file, as described in Specify the Migrate to Virtual Machines service account.
To create the migration source, run the following command:
migctl source create m2vm SOURCE_NAME --project PROJECT_ID --json-key M2VM_KEY.json --target-json-key COMPUTE_KEY.json --location LOCATION --m2vm-source M2VM_SOURCE
Replace the following:
- SOURCE_NAME: the name you want for the migration source
- PROJECT_ID: the ID of the Migrate to Virtual Machines project
- M2VM_KEY.json: the path of the service account json key used for the Migrate to Virtual Machines service
- COMPUTE_KEY.json: the path of the service account json key used for the Compute Engine service
- LOCATION: the Migrate to Virtual Machines service location. For example:
us-central1
- M2VM_SOURCE: the Migrate to Virtual Machines source name
migctl on Anthos on bare metal
VMware
migctl source create local-vmware local-vmware-src --vc 'VC' --username 'USERNAME' --dc VM_DC
Replace the following:
- VC: the vCenter DNS name or vCenter IP address. For example,
1.2.3.4
. - USERNAME: a user that has permission to access the vCenter. For example,
admin
. You are prompted to enter the user's password. - VM_DC: the vSphere datacenter for the
local-vmware
source. It is required in multi DC environments.
CRD
Compute Engine
Create a service account and download the JSON key file, as described in Creating a service account using Compute Engine.
Create a secret using the command:
kubectl create secret generic COMPUTE_SECRET -n v2k-system --from-file=cloud-platform-service-account-key=COMPUTE_KEY.json
Replace the following:
- COMPUTE_SECRET: the name you want for your Compute Engine secret
- COMPUTE_KEY.json: the name of the Compute Engine JSON file
To create a migration source, create a SourceProvider file called
my-source-provider.yaml
:apiVersion: anthos-migrate.cloud.google.com/v1beta2 kind: SourceProvider metadata: name: SOURCE_NAME spec: gce: project: PROJECT_ID serviceAccount: secretRef: name: COMPUTE_SECRET namespace: v2k-system
Replace the following:
- SOURCE_NAME: the name you want for your source
- PROJECT_ID: your project ID
- COMPUTE_SECRET: name of the secret
Apply the file:
kubectl apply -f my-source-provider.yaml
VMware
Create a service account and download the Compute Engine JSON key file, as described in Creating a service account using Compute Engine.
Create a Compute Engine secret using the command:
kubectl create secret generic COMPUTE_SECRET -n v2k-system --from-file=cloud-platform-service-account-key=COMPUTE_KEY.json
Replace the following:
- COMPUTE_SECRET: the name you want for your Compute Engine secret
- COMPUTE_KEY.json: the name of the Compute Engine JSON file
Create a service account and download the Migrate to Virtual Machines JSON key file, as described in Specify the Migrate to Virtual Machines service account.
Create a Migrate to Virtual Machines secret using the command:
kubectl create secret generic M2VM_SECRET -n v2k-system --from-file=cloud-platform-service-account-key=M2VM_KEY.json
Replace the following:
- M2VM_SECRET: the name you want for your Migrate to Virtual Machines secret
- M2VM_KEY.json: the name of the Migrate to Virtual Machines JSON file
To create a migration source, create a SourceProvider file called
my-source-provider.yaml
:apiVersion: anthos-migrate.cloud.google.com/v1beta2 kind: SourceProvider metadata: name: SOURCE_NAME spec: gce: project: PROJECT_ID serviceAccount: secretRef: name: COMPUTE_SECRET namespace: v2k-system remoteSourceSpec: migrateForCEService: location: LOCATION project: PROJECT_ID serviceAccount: secretRef: name: M2VM_SECRET namespace: v2k-system sourceName: M2VM_SOURCE
Replace the following:
- SOURCE_NAME: the name you want for your source
- PROJECT_ID: your project ID
- COMPUTE_SECRET: the name of the Compute Engine secret
- LOCATION: your project location
- M2VM_SECRET: the name of the Migrate to Virtual Machines secret
- M2VM_SOURCE: the Migrate to Virtual Machines source name
Apply the file:
kubectl apply -f my-source-provider.yaml
Console
Open the Migrate to Containers page in the Google Cloud console.
If you are using a remote Anthos cluster, meaning you are using Anthos on bare metal, and have not yet logged in to the cluster, log in now.
For more on accessing remote clusters, see Logging in to a cluster from the Google Cloud console.
Click the Sources tab to display a table containing the available sources.
Click Add Source.
Select a cluster where you have already installed the Migrate to Containers components from the drop-down list.
Click Next.
Specify the name of the source.
Select the Source type.
Click Next.
Configure the source based on your selection for Source type:
For Compute Engine:
Select the project that contains the VM that you want to migrate.
Select the service account. You can either:
- Create a new service account. You are prompted to enter the name of the new service account.
- Use an existing service account if you created one as described in Creating a service account for using Compute Engine as a migration source. When you select this option, you are prompted to enter the contents of the JSON key file associated with that service account.
Click Next.
Select Add Source.
After you add the source, your cluster should have a new SourceProvider.
kubectl get SourceProvider
Viewing a list of sources
You can view the list of migration sources using the
migctl source list
command or the Google Cloud console to confirm that you've successfully
configured your environment with the migration source.
migctl
migctl source list
If a source is not in the READY
state, you can get more information about the source,
including any error messages, by using the command:
migctl source status SOURCE_NAME
Console
Open the Migrate to Containers page in the Google Cloud console.
To display a table containing the available sources, click Manage sources.
Adding Migrate to Virtual Machines as a migration source
Prepare Migrate to Virtual Machines as a migration source
To use Migrate to Virtual Machines 5.0 as a migration source, you must first enable the Migrate to Virtual Machines services and install the connector, as described in the following steps:
Specify the Migrate to Virtual Machines service account
To use Migrate to Virtual Machines as a migration source, create a service
account with the vmmigration.admin
role bound on the service project:
Create the
m2c-m2vm-src-service
service account:gcloud iam service-accounts create m2c-m2vm-src-service --project=PROJECT_ID
Replace PROJECT_ID with your project ID.
Grant the
vmmigration.admin
role to the service account:gcloud projects add-iam-policy-binding PROJECT_ID \ --member="serviceAccount:m2c-m2vm-src-service@PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/vmmigration.admin"
Replace PROJECT_ID with your project ID.
Download the key file for the service account:
gcloud iam service-accounts keys create m2c-m2vm-src-service.json \ --iam-account=m2c-m2vm-src-service@PROJECT_ID.iam.gserviceaccount.com \ --project=PROJECT_ID
Replace PROJECT_ID with your project ID.
Specify the Migrate to Virtual Machines target project service account
To use Migrate to Virtual Machines as a migration source, create a service
account with the compute.instanceAdmin.v1
and compute.storageAdmin
roles bound
on the target project:
Create the
m2c-m2vm-src-gce
service account:gcloud iam service-accounts create m2c-m2vm-src-gce --project=PROJECT_ID
Replace PROJECT_ID with your project ID.
Grant the
compute.instanceAdmin.v1
role to the service account:gcloud projects add-iam-policy-binding TARGET_PROJECT_ID \ --member="serviceAccount:m2c-m2vm-src-gce@PROJECT_ID.iam.gserviceaccount.com --role="roles/compute.instanceAdmin.v1"
Replace PROJECT_ID with your project ID.
Grant the
compute.storageAdmin
role to the service account:gcloud projects add-iam-policy-binding TARGET_PROJECT_ID \ --member="serviceAccount:m2c-m2vm-src-gce@PROJECT_ID.iam.gserviceaccount.com" \ --role="roles/compute.storageAdmin"
Replace PROJECT_ID with your project ID.
Download the key file for the service account:
gcloud iam service-accounts keys create m2c-m2vm-src-gce.json \ --iam-account=m2c-m2vm-src-gce@PROJECT_ID.iam.gserviceaccount.com \ --project=PROJECT_ID
Replace PROJECT_ID with your project ID.
After downloading the service account key as a JSON file, you can create a source for migrating Migrate to Virtual Machines workloads.
What's next
- Learn how to create a migration plan.