监控迁移

使用 migctl 工具或 Google Cloud Console 查看执行迁移后的迁移进度。

migctl

列出迁移

如果您正在进行多个迁移,则可以通过运行 migctl migration list 同时查看所有迁移的简要状态。

migctl migration list

NAME                STATUS      CURRENT-OPERATION
my-migration        Completed   GenerateArtifacts
another-migration   Running     GenerateMigrationPlan

获取状态

使用 migctl migration status 获取迁移状态。 如果迁移状态表明迁移已完成,您可以继续下一步迁移操作。

migctl migration status my-migration

NAME            CURRENT-OPERATION       PROGRESS        STEP            STATUS  AGE
my-migration    GenerateArtifacts       [1/1]           ExtractImage    Running 12m2s

获取详细状态

如需了解详细状态、迁移事件以及警告和错误,请使用 -v 标志:

migctl migration status my-migration -v
apiVersion: anthos-migrate.cloud.google.com/v1beta2
kind: Migration
metadata:
annotations:
  kubectl.kubernetes.io/last-applied-configuration: |
    {"apiVersion":"anthos-migrate.cloud.google.com/v1beta2","kind":"Migration","metadata":{"annotations":{},"name":"my-migration","namespace":"v2k-system"},"spec":{"intent":"Image","osType":"Linux","sourceSnapshot":{"sourceId":"ub18-cloudimg-ref","sourceProvider":"my-onprem-src"}}}
creationTimestamp: "2020-07-07T11:39:35Z"
generation: 1
labels:
  migration: 6d6491
  migration-name: my-migration
  migration-namespace: v2k-system
  migration-uid: 6d644091-eaba-4-9fad46cc9ac8
name: my-migration
namespace: v2k-system
resourceVersion: "35454454"
selfLink: /apis/anthos-migrate.cloud.google.com/v1beta2/namespaces/v2k-system/migrations/my-migration
uid: 6d644091-eaba-4f74-6cc9ac8
spec:
intent: Image
osType: Linux
sourceSnapshot:
  sourceId: ub18-cloudimg-ref
  sourceProvider: my-onprem-src
status:
artifacts:
  deploymentFiles:
    artifactsManifestFile: v2k-system-my-migration/manifest.yaml
    bucket: velos-auto-1-migration-artifacts
    deploymentYaml: v2k-system-my-migration/deployment_spec.yaml
    dockerfile: v2k-system-my-migration/Dockerfile
    migrationFile: v2k-system-my-migration/migration.yaml
    type: gcs
  image: gcr.io/velos-auto-1/ub18-cloudimg-ref:v1.0.0
  imageBase: gcr.io/velos-auto-1/ub18-cloudimg-ref-non-runnable-base:v1.0.0
currentOperation: GenerateArtifacts
currentOperationSubSteps:
- description: ExtractImage
  status: Completed
- description: UploadImage
  status: Completed
- description: GenerateDeploymentFiles
  status: Completed
flowId: 6d644091
resources:
  generateArtifacts:
    name: generate-artifacts-flow-6d644091-4-bad4-9fad46cc9ac8
    status:
      completed: true
      deployment:
        artifactsManifestFile: v2k-system-my-migration/manifest.yaml
        deploymentYaml: v2k-system-my-migration/deployment_spec.yaml
        dockerfile: v2k-system-my-migration/Dockerfile
        migrationFile: v2k-system-my-migration/migration.yaml
        repositoryBucket: velos-auto-1-migration-artifacts
      image:
        extraction:
          copyProgress:
            copiedBytes: 1388683264
            sourceSizeBytes: 3659124736
          job:
            name: my-migration-task-export-job-ebd11e3e-6258-436e9cba969
          status: Completed
        upload:
          job:
            name: my-migration-task-image-upload-job-ebd11e3e-6253aca35
          status: Completed
  sourceSnapshot:
    name: source-snapshot-6d644091-eaba-4f74-46cc9ac8
    status:
      localVmware:
        cloneVm:
          create:
            cancelable: false
            cancelled: false
            endTime: "2020-07-07T11:40:44Z"
            error: ""
            finished: true
            id: task-18325
            name: CloneVM_Task
            progress: 0
            result: vm-1217
            startTime: "2020-07-07T11:40:42Z"
            state: success
            target: ub18-cloudimg-ref
        createPvcs:
        - claimPhase: Bound
          created: true
          csiPvc: false
          name: m4a-clone-eda18a2e-56cf-46ae-a129-db900c989a4218
          resourcePath: '[ds.23.0.131] m4a-clone-eda18a2e-56cf-46a1531441/m4a-clone-eda146ae-a129-db91441-000008.vmdk'
        - claimPhase: Bound
          created: true
          csiPvc: true
          name: v2k-csi-pvc-eda18a2e-56cf-46a9091531441
        createSnapshot:
          create:
            cancelable: false
            cancelled: false
            endTime: "2020-07-07T11:40:41Z"
            error: ""
            finished: true
            id: task-18324
            name: CreateSnapshot_Task
            progress: 0
            result: snapshot-1216
            startTime: "2020-07-07T11:40:40Z"
            state: success
            target: ub18-cloudimg-ref
      ready: true
status: Completed
Events:
Type     Reason                  Age                From                                                  Message
----     ------                  ----               ----                                                  -------
Normal   SuccessfulCreate        26m                Job my-migration-696gx-export-job-d99bb066-cb70-11ea  Created pod: my-migration-696gx-export-job-d99bb066-cb70-11ea
Warning  FailedScheduling        26m (x2 over 26m)  Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  pod has unbound immediate PersistentVolumeClaims (repeated 2 times)
Normal   Scheduled               26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Successfully assigned v2k-system/my-migration-696gx-export-job-d99b-cb70-11ea
6b3a5xcxd4 to gke-cluster-default-pool-8a1587ba
Normal   SuccessfulAttachVolume  26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  AttachVolume.Attach succeeded for volume "pvc-527e43c0-cb70-11ea-8166-42010a8401a9"
Normal   SuccessfulAttachVolume  26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  AttachVolume.Attach succeeded for volume "quickstart-instance-disk-5267c502-cb70-11ea-
8166-420fb4191f7d"
Normal   SuccessfulAttachVolume  26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  AttachVolume.Attach succeeded for volume "pvc-db74f143-cb70-11ea-8166-42010a8401a9"
Normal   SuccessfulMountVolume   26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  MapVolume.MapDevice succeeded for volume "quickstart-instance-disk-5267c502-cb70-11ea-
8166-420fb4191f7d" globalMapPath "/var/lib/kubelet/plugins/kubernetes.io/gce-pd/volumeDevices/quickstart-instance-disk-5267c502-cb70-11ea-8166-42010a8401a9"
Normal   SuccessfulMountVolume   26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  MapVolume.MapDevice succeeded for volume "quickstart-instance-disk-5267c502-cb70-11ea-
8166" volumeMapPath "/var/lib/kubelet/pods/db79e14e-cb70-11ea-8166/volumeDevices/kubernetes.io~gce-pd"
Normal   Pulling                 26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Pulling image "eu.gcr.io/my-proj/vls-runimg:test3"
Normal   Pulled                  26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Successfully pulled image "eu.gcr.io/my-proj/vls-runimg:test3"
Normal   Created                 26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Created container lister
Normal   Started                 26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Started container lister
Normal   Started                 26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Started container aggregator
Normal   Pulling                 26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Pulling image "eu.gcr.io/my-proj/v2k-init:test3"
Normal   Created                 26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Created container aggregator
Normal   Pulled                  26m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Successfully pulled image "eu.gcr.io/my-proj/v2k-init:test3"
Normal   Pulling                 25m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Pulling image "eu.gcr.io/my-proj/v2k-export:test3"
Normal   Pulled                  25m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Successfully pulled image "eu.gcr.io/my-proj/v2k-export:test3"
Normal   Created                 25m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Created container image-exporter
Normal   Started                 25m                Pod my-migration-696gx-export-job-d99bb066-cb70-11ea  Started container image-exporter
Normal   SuccessfulCreate        22m                Job my-migration-696gx-image-upload-job-d99bb066-cb70  Created pod: my-migration-696gx-image-upload-job-d99bb066-cb70-11c
Normal   Scheduled               22m                Pod my-migration-696gx-image-upload-job-d99bb066-cb70  Successfully assigned v2k-system/my-migration-696gx-image-upload-job-d99bb066-cb70-11c
db62e84c5q to gke-smg-cluster-default-pool-8a1587ba-p986
Normal   Created                 22m                Pod my-migration-696gx-image-upload-job-d99bb066-cb70  Created container image-uploader
Normal   Pulled                  22m (x2 over 22m)  Pod my-migration-696gx-image-upload-job-d99bb066-cb70  Container image "eu.gcr.io/my-proj/v2k-export:test3" already present on machi
ne
Normal   Started                 22m                Pod my-migration-696gx-image-upload-job-d99bb066-cb70  Started container image-uploader
Normal   Created                 22m                Pod my-migration-696gx-image-upload-job-d99bb066-cb70  Created container base-image-uploader
Normal   Started                 22m                Pod my-migration-696gx-image-upload-job-d99bb066-cb70  Started container base-image-uploader

控制台

如要使用 Google Cloud Console 监控迁移,请执行以下操作:

  1. 在 Cloud Console 中打开 Migrate for Anthos 页面。

    转到 Migrate for Anthos 页面

  2. 点击迁移标签页以显示包含可用迁移的表。

  3. 查看所需迁移所对应的行中的状态列。

  4. 点击所需迁移所在的行中的迁移名称。系统会打开迁移详情标签页。点击监控标签页以查看状态详情,或点击事件标签页以查看迁移事件。

CRD

使用 kubectl 通过指定必填字段的 JSONPath 来获取执行信息和状态。

  1. 获取迁移操作:

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

    返回 GenerateArtifacts

  2. 获取迁移状态:

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

    如果状态显示操作已完成,您可以继续下一步。

后续步骤