You begin migrating VMs by creating a migration. This results in a migration plan object. Further review and customization of the generated plan is typically required before proceeding to execute the migration.
A migration is the central object with which you perform migration actions,
monitor migration activities and status with the migctl
tool. The migration
object is implemented as a Kubernetes Custom Resource Definition (CRD).
Before you begin
Creating a migration
Create a migration by running the migctl
tool or the
GCP Console, as described in the following examples.
These examples use the Image
value for the intent
flag, which is the only option
supported for Windows. This flag configures Migrate for Anthos to create the
Dockerfile and other buildable artifacts required for a Windows migration.
migctl
Compute Engine
Stop the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart the VM.
Create the migration:
migctl migration create my-migration --source my-ce-src --vm-id my-id --intent Image --os-type=Windows
Where
--vm-id
specifies the name of the Compute Engine instance as shown in the Google Cloud Console.
CRD
Create a Migration
my-migration.yaml
file to define a migration.In this file,
sourceProvider
specifies the name of a previously created SourceProvider andsourceId
specifies the name of the Compute Engine instance:apiVersion: anthos-migrate.cloud.google.com/v1beta2 kind: Migration metadata: name: my-migration namespace: v2k-system annotations: anthos-migrate.cloud.google.com/initial-intent: Image spec: osType: Windows sourceSnapshot: sourceProvider: my-ce-src sourceId: my-id
Stop the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart the VM.
Apply the file:
kubectl apply -f my-migration.yaml
Console
Stop the Windows Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart the VM.
Open the Migrate for Anthos page in the Cloud Console.
Click the Migrations tab to display a table containing the available migrations.
Click Create Migration.
Enter the Migration name.
Select the migration source that you created in Adding a migration source. The type of the source must be Compute Engine and the source processing cluster must be configured to support migrating Windows VMs.
Set the VM OS type as Windows.
Enter the source VM ID, meaning the name of the VM as it appears in the Google Cloud Console.
Set the Migration intent as Image.
Click Create Migration.
When migration creation completes, the Status column displays Migration plan generated.
Monitoring migration creation
Use the migctl
tool or the GCP Console
to monitor the progress of migration creation.
migctl
Wait until the migration has Completed:
migctl migration status my-migration NAME CURRENT-OPERATION PROGRESS STEP STATUS AGE my-migration GenerateMigrationPlan [1/3] CreateSourceSnapshots Running 13s
Restart the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart it.
CRD
Use kubectl
to get migration 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
GenerateMigrationPlan
.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.
Restart the Compute Engine VM. The VM must be stopped for you to create a migration. After the migration completes, you can restart it.
Console
When migration status show thats the migration has been created, you can move on to the next step:
Open the Migrate for Anthos 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 migration creation completes, the Status displays Migration plan generated.
You can now restart the Windows Compute Engine VM, if necessary. The VM must be stopped for you to create a migration.