监控迁移

执行迁移后,您可以使用 migctl 工具来查看迁移进度。

使用以下命令进行监控:

列出迁移

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

migctl migration list
NAME                STATE                      STATUS    PROGRESS   AGE
my-migration        waitingForImageExportJob   RUNNING   [6/12]     20m
another-migration   storeDeploymentArtifacts   RUNNING   [11/12]    24m

获取单次迁移的简要状态

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

migctl migration status my-migration
NAME           STATE                      STATUS    PROGRESS   AGE
my-migration   waitingForImageUploadJob   RUNNING   [12/15]    4m22s

获取单次迁移的详细状态

如需了解更详细的状态、迁移中的事件以及警告和错误,请使用 -v 标志并运行 migctl migration status migration-name -v

migctl migration status my-migration -v
Name:         my-migration
Namespace:    default
Labels:       
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"anthos-migrate.cloud.google.com/v1beta1","kind":"Migration","metadata":{"annotations":{},"name":"my-migration","namespace":...
API Version:  anthos-migrate.cloud.google.com/v1beta1
Kind:         Migration
Metadata:
  Creation Timestamp:  2020-03-01T18:14:23Z
  Generation:          1
  Resource Version:    19563
  Self Link:           /apis/anthos-migrate.cloud.google.com/v1beta1/namespaces/default/migrations/my-migration
  UID:                 7a75680a-5be8-11ea-9e24-42010a800028
Spec:
  Artifacts:
    Deployment:
      App Name:     app-centos-mini
      Bucket:       my-project-migration-artifacts
      Path Prefix:  default-my-migration/
    Exclude Filters:
      - *.swp
      - /etc/fstab
      - /boot/
      - /tmp/*
      - /var/log/*
      - /var/cache/*
    Image:
      Base:  gcr.io/my-project/centos-mini-non-runnable-base:v1.0.0
      Filters:
        
      Name:  gcr.io/my-project/centos-mini:v1.0.0
  Source:
    Vmware:
      Run Mode:            TestClone
      Storage Class Name:  my-vmware-src
      Vm Id:               centos-mini
Status:
  Progress:  [6/12]
  State:     waitingForImageExportJob
  Status:    RUNNING
  Steps:
    Name:    enforceRetainReclamationPolicy
    Status:  COMPLETED
    Name:    createStreamingPvc
    Status:  COMPLETED
    Name:    createScratchPvc
    Status:  COMPLETED
    Name:    createImageExportConfigMap
    Status:  COMPLETED
    Name:    createImageExportJob
    Status:  COMPLETED
    Name:    waitingForImageExportJob
    Status:  RUNNING
    Name:    deleteImageExportJob
    Status:  PENDING
    Name:    createImageUploadJob
    Status:  PENDING
    Name:    waitingForImageUploadJob
    Status:  PENDING
    Name:    deleteImageUploadJob
    Status:  PENDING
    Name:    storeDeploymentArtifacts
    Status:  PENDING
    Name:    cleanup
    Status:  PENDING
Events:
  Type     Reason            Age                  From                  Message
  ----     ------            ----                 ----                  -------
  Warning  FailedScheduling  24m (x801 over 19h)  migration-controller  my-migration-export-job-7a75680a-5be8-11ea-9e24-42010a800028 - pod has unbound immediate PersistentVolumeClaims (repeated 3 times)

监控状态更新

您可以使用 status 命令的 -w 标志来启动控制台提示,以便在有新的状态消息时显示这些消息。

$ migctl migration status my-migration -w
NAME           AGE
my-migration   20m

后续步骤