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:

  • Generate a migration zip file with the extracted application files, settings, and Dockerfile.

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

  • Use the migration artifacts in the zip file to build a container image.

  • Deploy the image to your GKE 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

CRD

  1. Create a WindowsGenerateArtifactsTask 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: WindowsGenerateArtifactsTask
    metadata:
     name: my-migration-task
     namespace: v2k-system
    spec:
     migration:
       name:  my-migration
  2. Apply the file:

    kubectl apply -f my-generate.yaml

When you generate artifacts for Windows workloads, Migrate for Anthos writes the artifacts to a zip file and then uploads the zip file to a Cloud Storage bucket. This zip file contains a Dockerfile and several directories and files that are extracted from the source and used by the Dockerfile.

To check the migration progress:

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.

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