我按照这个文档用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)
由于storageclass.storage.k8s.io "v2k-csi-gce-disk" not found
:,似乎无法提供PVC
$ 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
由于集群上缺少Migrate for Anthos GKE应用程序(v2k csi gce disk StorageClass是该应用程序的一部分(,它似乎失败了。GCE虚拟机迁移的先决条件在配置集群和为Anthos创建迁移配置页面中进行了总结。事实上,当前版本的文档似乎对先决条件有点隐含,将对此进行后续操作。