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 to Containers.
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
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}
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, andflow
represents theAppxGenerateArtifactsFlow
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
Apply the file:
kubectl apply -f my-generate.yaml
Console
Open the Migrate to Containers page in the 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 to Containers 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.