1

我按照此文档使用 Migrate for Anthos 将 GCE Debian 9 VM 迁移到 GKE,但是当我将生成的 YAML 应用到我的 GKE 集群时,Pod 无法调度,事件包括此错误:

Warning  FailedScheduling  52s (x14 over 7m59s)  default-scheduler  pod has unbound immediate PersistentVolumeClaims (repeated 3 times)

似乎未能配置 PVC,因为storageclass.storage.k8s.io "v2k-csi-gce-disk" not found

$ kpvcs-describe my-app-pvc
Name:          my-app-pvc
Namespace:     default
StorageClass:  v2k-csi-gce-disk
Status:        Pending
...
Events:
  Warning  ProvisioningFailed  103s (x9 over 5m14s)  persistentvolume-controller  storageclass.storage.k8s.io "v2k-csi-gce-disk" not found

这是生成的 YAML:

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: my-app-pvc
spec:
  storageClassName: v2k-csi-gce-disk
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50G

---
apiVersion: v1
kind: PersistentVolume
metadata:
  name: vls-pv-vls-c7c8-dagang-test
spec:
  storageClassName: ""
  capacity:
    storage: 50G
  accessModes:
    - ReadWriteOnce
  gcePersistentDisk:
    # Name of pd
    pdName: vls-c7c8-dagang-test
  volumeMode: Block
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: vls-pvc-vls-c7c8-dagang-test
spec:
  storageClassName: ""
  volumeName: vls-pv-vls-c7c8-dagang-test
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50G
  volumeMode: Block

---
kind: StatefulSet
apiVersion: apps/v1beta2
metadata:
  name: my-app
  namespace: default
spec:
  serviceName: "my-app-svc"
  replicas: 1
  selector:
    matchLabels:
      app: my-app
  template:
    metadata:
      labels:
        app: my-app
    spec:
      initContainers:
      - name: lister
        image: anthos-migrate.gcr.io/vls-runimg:v0.9.7
        imagePullPolicy: Always
        volumeMounts:
        - name: volumes
          mountPath: /volumes
        volumeDevices:
        - name: vls-c7c8-dagang-test
          devicePath: /devices/000-vls-c7c8-dagang-test

        env:
          - name: "HC_BOOT_DEVICE_NAME"
            value: "000-vls-c7c8-dagang-test"
          - name: "HC_DEVICES_DIR"
            value: "/devices"
          - name: "HC_DEVICES_LIST_DIR"
            value: "/volumes"
          - name: "HC_RUNNER_PARAMS"
            value: "listdevs"
      - name: init
        image: anthos-migrate.gcr.io/v2k-init:v0.9.7
        imagePullPolicy: Always
        env:
          - name: "HC_BLOCKDEV_MODE"
            value: "true"
          - name: "HC_TRIM_MOUNTS"
            value: "false"
          - name: "HC_VOLUME_PATH"
            value: "/volumes"
        volumeMounts:
        - name: volumes
          mountPath: /volumes
        - name: vlsdata
          mountPath: /vlsdata
          mountPropagation: Bidirectional
        - name: lvmdata
          mountPath: /run/lvm
        - name: udevdata
          mountPath: /run/udev
        securityContext:
          privileged: true
      containers:
      - name: my-app
        image: anthos-migrate.gcr.io/v2k-run:v0.9.7
        imagePullPolicy: Always
        volumeMounts:
        - name: vlsdata
          mountPath: /vlsdata
          mountPropagation: Bidirectional
        - name: cgroups
          mountPath: /sys/fs/cgroup
        securityContext:
          privileged: true
        readinessProbe:
          exec:
            command:
            - /code/ready.sh
      volumes:
      - name: vls-c7c8-dagang-test
        persistentVolumeClaim:
          claimName: vls-pvc-vls-c7c8-dagang-test
          readOnly: false

      - name: volumes
        emptyDir: {}
      - name: vlsdata
        persistentVolumeClaim:
          claimName: my-app-pvc
          readOnly: false
      - name: lvmdata
        hostPath:
          path: /run/lvm
          type: Directory
      - name: udevdata
        hostPath:
          path: /run/udev
          type: Directory
      - name: cgroups
        hostPath:
          path: /sys/fs/cgroup
          type: Directory
4

1 回答 1

1

看起来由于集群上缺少 Migrate for Anthos GKE 应用程序而失败(v2k-csi-gce-disk StorageClass 是此应用程序的一部分)。配置集群为 Anthos 创建迁移配置页面中总结了 GCE 虚拟机迁移的先决条件。实际上,当前版本的文档似乎对先决条件有点隐含,将对此进行跟进。

于 2019-11-21T14:30:54.967 回答