我按照此文档使用 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