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 the migctl tool. The migration object is implemented as a Kubernetes Custom Resource Definition (CRD).

Before you begin

Creating a migration

Create a migration by running the migctl tool or the GCP Console, as described in the following examples.

These examples use the Image value for the intent flag, which is the only option supported for Windows. This flag configures Migrate for Anthos to create the Dockerfile and other buildable artifacts required for a Windows migration.

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 --os-type=Windows

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

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: Windows
     sourceSnapshot:
      sourceProvider: my-ce-src
      sourceId: my-id
  2. 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.

  3. Apply the file:

    kubectl apply -f my-migration.yaml

Console

  1. Stop the Windows 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. The type of the source must be Compute Engine and the source processing cluster must be configured to support migrating Windows VMs.

  7. Set the VM OS type as Windows.

  8. Enter the source VM ID, meaning the name of the VM as it appears in the Google Cloud Console.

  9. Set the Migration intent as Image.

  10. Click Create Migration.

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

Monitoring migration creation

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

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. Restart the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart it.

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. Restart the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart it.

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. You can now restart the Windows Compute Engine VM, if necessary. The VM must be stopped for you to create a migration.

Next Steps