Executing a migration

You begin migrating VMs with a command that generates target container artifacts and extracts them using the processing cluster you created in Installing Migrate for Anthos.

This topic describes how to execute a migration to:

  • Extract workload artifacts from the VM into a container image and data volume (for stateful workloads).
  • Copy a container image of your VM into a container registry.
  • Generate migration deployment artifacts you can use for production deployments.

Once this step has completed, you'll be able to:

  • Test the image and data volume (for stateful workloads) on the processing cluster.

    Though you haven't yet deployed the image to a separate cluster, it is runnable and testable. Once migration is complete, the image is not connected with the source VM.

  • Deploy the image and data volume (for stateful workloads) to another cluster.

Before you begin

To succeed, you should have first done the following:

Executing the migration and generating artifacts

Use the migctl migration generate-artifacts command or the GCP Console to generate target container artifacts as part of processing a VM for migration.

migctl

migctl migration generate-artifacts my-migration

Console

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

    Go to the Migrate for Anthos page

  2. In the row for the desired migration, select Generate artifacts in the Next steps dropdown.

  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 the Status of the migration is Artifacts generated you can move on to the next step.

CRD

  1. Create a GenerateArtifactsTask my-generate.yaml file to define a migration.

    In this file, set the value of the name field for migration to the name you specified in the Migration yaml when you created the migration:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: GenerateArtifactsTask
    metadata:
     name: my-migration-task
     namespace: v2k-system
    spec:
     migration:
       name:  my-migration
  2. Apply the file:

    kubectl apply -f my-generate.yaml

When generating artifacts, Migrate for Anthos:

  • Copies files and directories representing the VM to the Container Registry as images.

    Migrate for Anthos creates two images: a runnable image for deployment to another cluster and a non-runnable image layer that can be used to update the container image in the future. See Customizing a migration plan for information on how to identify these images.

  • Generates configuration YAML files that you can use to deploy the extracted workload to another GKE cluster. These are copied into a Cloud Storage bucket as an intermediate location. You can later download these files.

To check the migration progress for migctl and CRD migrations you can poll the status:

migctl

migctl migration status my-migration

NAME            CURRENT-OPERATION       PROGRESS        STEP            STATUS  AGE
my-migration    GenerateArtifacts       [1/1]           ExtractImage    Running 12m2s

When the migration completes, you should see a message such as the following when you request status with migctl migration status.

migctl migration status my-migration

NAME            CURRENT-OPERATION       PROGRESS        STEP            STATUS    AGE
my-migration    GenerateArtifacts       [1/1]           ExtractImage    Completed 14m23s

You can also add the -v flag to get error and warning information. See Monitoring a migration for more.

Console

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

    Go to the Migrate for Anthos page

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

  3. When the Status of the migration is Artifacts generated you can move on to the next step.

CRD

Use kubectl to get execution 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 GenerateArtifacts.

  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.

Next Steps