Executing a migration

To begin migrating your VMs, you will use a command that generates the target container artifacts and extracts them with the processing cluster you created in Installing Migrate to Containers. This topic describes how to execute a migration to extract application files, settings, and Dockerfile.

Once this step is completed, you will be able to:

  • Use the migration artifacts to build a container image.
  • Deploy the image to your GKE cluster.

Before you begin

This topic assumes that you've already:

Executing the migration and generating artifacts

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

migctl

migctl migration generate-artifacts my-migration

CRD

  1. Get the name of the AppXGenerateArtifactsFlow using the name specified in the Migration yaml when you created the migration:

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

  2. Create an AppXGenerateArtifactsTask my-generate.yaml file to define a generate artifacts task.

    In this file, migration specifies the migration name when you created the migration, and flow represents the AppxGenerateArtifactsFlow of the migration which you got on previous step:

    apiVersion: anthos-migrate.cloud.google.com/v1beta2
    kind: AppXGenerateArtifactsTask
    metadata:
     name: my-migration-task
     namespace: v2k-system
    spec:
     migration:
       name:  my-migration
     flow:
       name: appx-generateartifactsflow-my-migration
  3. Apply the file:

    kubectl apply -f my-generate.yaml

Console

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

    Go to the Migrate to Containers page

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

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

  4. View the status of a migration by:

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

    • Clicking the migration Name. The migration Details tab opens. Click the Monitoring tab to see the status details, or the Events tab to see migration events.

When you generate artifacts for Tomcat workloads, Migrate to Containers writes the artifacts and then uploads them to a Cloud Storage bucket. The artifact directory file contains:

  • Dockerfile - The Dockerfile used to build the image for your migrated VM.
  • deployment_spec.yaml - The YAML file that configures your workload.

    You can use kubectl apply with this file to deploy the workload to a cluster, such as a production or test cluster.

  • Directories and files that are extracted from the source and used by the Dockerfile.

Next Steps

Monitoring a migration.