Add a migration source

Before you start a migration, you will create a migration source that represents the source platform from where you want to migrate the application. This will be included in your migration plan. This topic describes how to create a source for each of the supported source platforms.

You can deploy the containerized application to the following:

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, AWS, Azure, Compute Engine, or on-premises.

migctl on Google Cloud

Compute Engine

  1. 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.

  2. Create the source using the service account:

    migctl source create ce my-ce-src --project my-project --json-key=m2c-ce-src.json

    Where m2c-ce-src.json specifies the service account.

VMware

migctl source create vmware my-vmware-src --manager-address 1.2.3.4 --cloud-extension my-cloud-extension

Specify the:

You are prompted for the password for your Migrate to VMs management server.

AWS

migctl source create aws my-aws-src --manager-address 1.2.3.4 --cloud-details cloud-details --cloud-extension cloud-extension

Specify the:

You are prompted for the password for your Migrate to VMs management server.

Azure

migctl source create azure my-azure-src --manager-address 1.2.3.4 --cloud-details cloud-details --cloud-extension cloud-extension

Specify the:

You'll be prompted for the password for your Migrate to VMs management server.

migctl on VMware

VMware

migctl source create local-vmware local-vmware-src --vc '1.2.3.4' --username 'admin'

Where:

  • --vc specifies the vCenter DNS name or vCenter IP address.
  • --username specifies a user that has permission to access the vCenter. You are prompted to enter the user's password.

migctl on AWS

AWS

  1. Create the source:

    migctl source create local-aws local-aws-src --region my-region --access-key-id my-access-key-id

    or:

    migctl source create local-aws local-aws-src --region my-region --credentials-file-path=credentials.csv

    Where:

    • --region specifies the Google Cloud region of your cluster.
    • --access-key-id specifies the AWS access key ID for a user that has permission to access AWS. You are prompted to enter the secret for the access key ID. See Managing access keys for IAM users for more.
    • --credentials-file-path specifies the path to a CSV file, downloaded from the AWS console, containing the credentials. See Configuring AWS IAM groups and instance roles for more on creating the CSV file.

CRD

  1. Create a SourceProvider my-source-provider.yaml file to create a migration source:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: SourceProvider
    metadata:
      name: my-ce-src
    spec:
      gce:
        project: my-project 
    
  2. If you are using Compute Engine as the migration source:

    1. Create a service account and download the JSON key file, as described in Configuring a service account

    2. Create a secret named my-secret using the command:

      kubectl create secret generic my-secret -n v2k-system --from-file=cloud-platform-service-account-key=m2c-ce-src.json
    3. Include the secret in the SourceProvider:

      apiVersion: anthos-migrate.cloud.google.com/v1beta2
      kind: SourceProvider
      metadata:
       name: my-ce-src
      spec:
       gce:
         project: my-project
         serviceAccount:
           secretRef:
             name: my-secret
             namespace: v2k-system
  3. If you are performing a migration for AWS, Azure, or VMware, edit the SourceProvider to specify the following:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: SourceProvider
    metadata:
      name: migration-source-name
    spec:
      migrateForCE:
        management:
          address: manager-ip-address
          cloudDetails: 
            platform: aws | azure | vmware
            name: Name of the source, as configured in Migrate to VMs
          cloudExtension: ID or name of the Migrate to Containers extension
          password:
            <-- Password for your Migrate to VMs management server. --->
            secretRef:
              name: secret-name
              namespace: v2k-system
  4. If you are performing a migration on Anthos clusters on VMware, you must create a secret for the vCenter credentials, in the form:

    kubectl create secret generic secret-vcenter -n v2k-system --from-literal='vc-password=pass1'

    Then include the secretRef:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: SourceProvider
    metadata:
      name: my-ce-src
    spec:
      localVmware:
        address: 1.2.3.4
        username: admin
        password:
          secretRef:
            name: secret-vcenter        
            namespace: v2k-system
  5. If you are performing a migration on Anthos clusters on AWS, you must create a secret for the AWS credentials, in the form:

    kubectl create secret generic secret-aws -n v2k-system --from-literal='AwsAccessKeyId=admin' --from-literal='AWS_SECRET_ACCESS_KEY=pass1'

    Then include the secretRef:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: SourceProvider
    metadata:
      name: my-ce-src
    spec:
      localAws:
        # Google Cloud region of cluster.
        region: my-region
        accessKeyId: admin
        secretAccessKey:
          secretRef:
            name: secret-aws        
            namespace: v2k-system
  6. Apply the file:

    kubectl apply -f my-source-provider.yaml

Console

  1. Open the Migrate to Containers page in the console.

    Go to the Migrate to Containers page

  2. If you are using a remote Anthos cluster, meaning you are using Anthos clusters on VMware or Anthos clusters on AWS, 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 console.

  3. Click the Sources tab to display a table containing the available sources.

  4. Click Add Source.

  5. Select a cluster where you have already installed the Migrate to Containers components from the drop-down list.

  6. Click Next.

  7. Specify the name of the source, such as my-ce-source1.

  8. Select the Source type.

  9. Click Next.

  10. Configure the source based on your selection for Source type:

    1. For Compute Engine:

      1. Select the project that contains the VM that you want to migrate.

      2. Select the service account. You can either:

        1. Create a new service account. You are prompted to enter the name of the new service account.
        2. 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.
    2. For VMware, AWS, and Azure:

      1. Specify the IP address or URL of the Migrate to VMs Manager.

      2. Specify the password of the Migrate to VMs Manager.

      3. Specify the name of the Migrate to VMs Extension.

      4. (AWS and Azure only) Specify the Cloud Details name, as configured in Migrate to VMs.

    3. For Local VMware:

      1. Specify the vCenter DNS name or vCenter IP address.

      2. Specify the user and password for a vCenter user that has permission to access the vCenter.

    4. For Local AWS:

      1. Specify the region of your cluster.

      2. Specify the AWS credentilas as either:

        • An access key ID and secret for a user that has permission to access AWS.
        • A credentials CSV file, downloaded from the AWS console, containing the credentials. See Configuring AWS IAM groups and instance roles for more on creating the CSV file.
  11. Click Next.

  12. Select Add Source.

After you add the source, your cluster should have a new SourceProvider whose name is your source name, here my-vmware-src:

kubectl get SourceProvider
NAME                 STATE
my-vmware-src        READY

Viewing a list of sources

You can view the list of migration sources using the migctl source list command. You can use the command's output to confirm that you've successfully configured your environment with the migration source.

migctl

migctl source list
NAME            TYPE    STATE   PROJECT     CLOUD-DETAILS   CLOUD-EXTENSION     VCENTER/MANAGER-ADDRESS
my-vmware-src   VMware  READY my-project  VMware        my-cloud-extension  1.2.3.4

Where VCENTER/MANAGER-ADDRESS specifies:

  • For Cloud migrations, the address of your Migrate to VMs management server.
  • For on-prem migrations, the vCenter DNS name or vCenter IP address.

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 my-vmware-src

Console

  1. Open the Migrate to Containers page in the console.

    Go to the Migrate to Containers page

  2. Click the Sources tab to display a table containing the available sources.

    In the table VCENTER/MANAGER-ADDRESS specifies the address of your Migrate to VMs management server.

Deleting a source

After you validate and test the migrated workload to ensure that it is functioning correctly, you should delete the migration. Deleting the migration frees up any resources used by the migration.You might also delete a source if you want to make a change and then create it again.

migctl source delete my-tomcat-src

Next Steps

Creating a migration.