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 and GKE.
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:
- Create a migration to generate a migration plan.
- Customize the migration plan, if needed.
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
Create a WindowsGenerateArtifactsTask
my-generate.yaml
file to define a migration.In this file, set the value of the
name
field formigration
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
Apply the file:
kubectl apply -f my-generate.yaml
Console
Open the Migrate for Anthos and GKE page in the Cloud console.
Click the Migrations tab to display a table containing the available migrations.
In the row for the desired migration, select Generate artifacts in the Next steps dropdown.
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 Windows workloads, Migrate for Anthos and GKE writes the artifacts to a zip file and then uploads the zip file to a Cloud Storage bucket. This zip 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.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.
Get the migration operation:
kubectl get migrations.anthos-migrate.cloud.google.com -n v2k-system my-migration -o jsonpath={.status.currentOperation}
Returns
GenerateArtifacts
.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.
Console
Open the Migrate for Anthos and GKE page in the Cloud console.
Click the Migrations tab to display a table containing the available migrations.
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.
When the Status of the migration is Artifacts generated you can move on to the next step.