Creating a migration

You begin migrating VMs by creating a migration. This results in a migration plan object. Further review and customization of the generated plan is typically required before proceeding to execute the migration.

A migration is the central object with which you perform migration actions, monitor migration activities and status with migctl and the Google Cloud Console. The migration object is implemented as a Kubernetes Custom Resource Definition (CRD), and is contained along with additional resources such as a Kubernetes PersistentVolumeClaim in the migration plan.

Before you begin

Compute Engine

VMware

  • vmId -- ID or name of the VM to migrate as it is known on the source platform. You can use one of the following values.

    • The VM name. If you're confident that each VM name is unique across your VMware deployment, the simple VM name will work. If VM names might be duplicated, use the VM ID as described below.

      You can get the VM name from the vSphere web client, as shown in the following image.

    • The VM ID from vSphere (also called a MoRef). This is visible from the URL of the vSphere web client when selecting the VM.

      The MoRef is in the URL from vSphere

      You can find also the MoRef by using PowerCLI.

AWS

The Instance ID in the Amazon EC2 console

Azure

  • vmId -- The Azure VM resource ID for your source VM. To get this value, you can:

    1. Access and log in to the Azure Portal.
    2. In the navigation panel on the left, click Virtual Machines.
    3. On the Virtual Machines page, click the name of your VM.
    4. On your VM's page, in the navigation panel, click Properties.
    5. In the Properties page, locate the Resource ID value.

      The resource ID in the Azure portal

    6. Use the Resource ID value.

Creating a migration

Create a migration by using the migctl tool or the Google Cloud Console.

The following examples use the Image value for the intent flag. However, you'll choose the intent flag's value based on your workload and the migration results you want. See the section later in this topic for more.

GKE migctl

Compute Engine

  1. Stop the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart the VM.

  2. Create the migration:

    migctl migration create my-migration --source my-ce-src --vm-id my-id --intent Image

    Where --vm-id specifies the name of the Compute Engine instance as shown in the Google Cloud Console.

VMware

migctl migration create my-migration --source my-vmware-src --vm-id My_VMware_VM --intent Image

Where --vm-id specifies the name of the VM instance. You can specify either the VM name, such as MyVM2, or the VM MoRef ID (Managed Object Reference ID), such as vm-14. See Before you begin for more on determining the VM ID.

AWS

migctl migration create my-migration --source my-aws-src --vm-id i-1234567890abcdef0 --intent Image

Where --vm-id specifies the name of the VM instance. The name of the VM instance is shown in the AWS UI and is in form i-##########. See Before you begin for more on determining the VM ID.

Azure

migctl migration create my-migration --source my-azure-src --vm-id /subscriptions/a1b5c3d4-c3d9-a1a2-e5f6-a1t2c3d4k5f6/resourceGroups/MyResourceGroup/providers/Microsoft.Compute/virtualMachines/my-virtual-machine --intent Image

Where --vm-id specifies the name of the VM instance. The name of the VM instance is shown in the Azure UI. See Before you begin for more on determining the VM ID.

Anthos clusters on VMware migctl

VMware

migctl migration create my-migration --source local-vmware-src --vm-id My_VMware_VM --intent Image

Where --vm-id specifies the name of the VM instance. You can specify either the VM name, such as MyVM2, or the VM MoRef ID (Managed Object Reference ID), such as vm-14. See Before you begin for more on determining the VM ID.

Console

  1. If the migration source is a Compute Engine VM, stop the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart the VM.

  2. Open the Migrate for Anthos page in the Cloud Console.

    Go to the Migrate for Anthos page

  3. Click the Migrations tab to display a table containing the available migrations.

  4. Click Create Migration.

  5. Enter the Migration name.

  6. Select the migration source that you created in Adding a migration source.

  7. Set the VM OS type as Linux.

  8. Enter the source VM ID. See Before you begin for more on determining the VM ID.

  9. Set the Migration intent as described below.

  10. Click Create Migration.

    When migration creation completes, the Status column displays Migration plan generated.

CRD

  1. Create a Migration my-migration.yaml file to define a migration.

    In this file, sourceProvider specifies the name of a previously created SourceProvider and sourceId specifies the name of the Compute Engine instance:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: Migration
    metadata:
     name: my-migration
     namespace: v2k-system
     annotations:
       anthos-migrate.cloud.google.com/initial-intent: Image
    spec:
     osType: Linux
     sourceSnapshot:
      sourceProvider: my-ce-src
      sourceId: my-id
  2. If you are migrating a Compute Engine VM, stop the VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart the VM.

  3. Apply the file:

    kubectl apply -f my-migration.yaml

Setting the migration intent

When you create a migration, you specify an intent flag value based on the nature of your workload. The flag's value determines the contents of your migration plan, which in turn guides the migration.

Intent flag value When to use Notes
Image Use with stateless workloads.
ImageAndData Use with stateful workloads where the application and user mode system is extracted to a container image, and data is extracted to a persistent volume. You can also use ImageAndData for image-only extraction for stateful workloads, where data is extracted or synchronized separately. Having ImageAndData is the comprehensive workflow. It results in additional artifacts to deal with and also impacts considerations in the delete action.
Data Use with stateful workloads where only the data portion of the migration plan will be extracted into a persistent volume. If you execute with this intent value repeatedly using the same source VM and migration plan, the result will be to synchronize delta changes to the target persistent disk, since the previous data sync.

Monitoring migration creation

Use the migctl tool or the GCP Console to monitor the progress of migration creation.

GKE migctl

  1. Wait until the migration has completed:

    migctl migration status my-migration
    
    NAME           CURRENT-OPERATION      PROGRESS   STEP                   STATUS   AGE
    my-migration   GenerateMigrationPlan  [1/3]      CreateSourceSnapshots  Running  13s 
  2. If you are migrating a Compute Engine VM, then restart it. The VM must be stopped for you to create a migration.

Anthos clusters on VMware migctl

Wait until the migration has Completed:

migctl migration status my-migration

NAME           CURRENT-OPERATION      PROGRESS STEP                   STATUS   AGE
my-migration   GenerateMigrationPlan  [1/3]    CreateSourceSnapshots  Running  13s

Console

When migration status show thats the migration has been created, you can move on to the next step:

  1. Open the Migrate for Anthos page in the Cloud Console.

    Go to the Migrate for Anthos page

  2. Click the Migrations tab to display a table containing the available migrations.

  3. View the status of a migration by:

    • Clicking the migration name. The Migration details panel opens to display the migration status and other information.

    • Viewing the Status column for the row for your migration.

  4. When migration creation completes, the Status displays Migration plan generated.

  5. If you are migrating a Compute Engine VM, then restart it. The VM must be stopped for you to create a migration.

CRD

Use kubectl to get migration information and status by specifying a JSONPath to the necessary field.

  1. Get the migration operation:

    kubectl get migrations.anthos-migrate.cloud.google.com -n v2k-system  my-migration -o jsonpath={.status.currentOperation}

    Returns GenerateMigrationPlan.

  2. Get the migration status:

    kubectl get migrations.anthos-migrate.cloud.google.com -n v2k-system my-migration -o jsonpath={.status.status}

    When the status shows that the operation has completed, you can move on to the next step.

  3. If you are migrating a Compute Engine VM, then restart it. The VM must be stopped for you to create a migration.

Next Steps