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:
- 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:
- 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
target container artifacts as part of processing a VM for migration.
migctl
migctl migration generate-artifacts my-migration
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 detailed status, or the Events tab to see migration events.
When the Status of the migration is Artifacts generated you can move on to the next step.
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
When generating artifacts, Migrate to Containers:
Copies files and directories representing the VM to the Container Registry as Docker images.
Migrate to Containers 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.