Резюме Я подготовил кубернеты на нескольких виртуальных машинах vcenter с помощью kubespray, и все там работает отлично. Однако у меня возникли проблемы с настройкой Vsphere в качестве облачного провайдера и динамической подготовки постоянных томов. Я пробовал следовать этому руководству по настройке Vsphere в качестве провайдера. Кажется, что все стручки запускаются:
vsphere-cloud-controller-manager-5h8vr 1/1 Running 0 77m
vsphere-csi-controller-0 5/5 Running 0 52m
vsphere-csi-node-9gcn5 3/3 Running 0 23m
vsphere-csi-node-lcmvn 3/3 Running 0 23m
vsphere-csi-node-pgbcj 3/3 Running 0 23m
vsphere-csi-node-rvx4m 3/3 Running 0 23m
Однако, если я описываю pv c, я получаю эту ошибку:
Warning ProvisioningFailed 64s (x30 over 52m) persistentvolume-controller Failed to provision volume with StorageClass "fast": Cloud provider not initialized properly
Единственная ошибка, которую я могу найти, - это vsphere -csi-nodes:
k logs vsphere-csi-node-pgbcj -c vsphere-csi-node
I0709 18:03:55.515251 1 service.go:88] configured: csi.vsphere.vmware.com with map[mode:node]
time="2020-07-09T18:03:55Z" level=info msg="identity service registered"
time="2020-07-09T18:03:55Z" level=info msg="node service registered"
time="2020-07-09T18:03:55Z" level=info msg=serving endpoint="unix:///csi/csi.sock"
I0709 18:03:57.645866 1 config.go:261] GetCnsconfig called with cfgPath: /etc/cloud/csi-vsphere.conf
I0709 18:03:57.645925 1 config.go:265] Could not stat /etc/cloud/csi-vsphere.conf, reading config params from env
E0709 18:03:57.645968 1 config.go:202] No Virtual Center hosts defined
E0709 18:03:57.645983 1 config.go:269] Failed to get config params from env. Err: No Virtual Center hosts defined
I0709 18:03:57.645995 1 node.go:471] Config file not provided to node daemonset. Assuming non-topology aware cluster.
Просматривая «секреты», кажется, что вся эта информация была распространена правильно.
Предварительные требования на месте
- Версия оборудования виртуальной машины> 15
- UUID включен на всех виртуальных машинах
- Vsphere> 6,7
Среда
- Один главный
- Три узла
- ОС хоста: Debian 10.04 64bit
- Kubespray: последняя
- Kubernetes: 1.18.5
- VM «аппаратная версия»: 17
- Esxi 7
- Vcenter 7
- CNI Weave
Config Файлы
group_vars / all.yml
cloud_provider: "external"
external_cloud_provider: "vsphere"
vsphere.conf
# Vsphere provider
external_vsphere_vcenter_ip: "serveriphere"
external_vsphere_vcenter_port: "443"
external_vsphere_insecure: "true"
external_vsphere_user: "localadminaccout@vsphere.local"
external_vsphere_password: "indestructiblepasswordhere"
external_vsphere_datacenter: "LAB"
external_vsphere_kubernetes_cluster_id: "k8"
vsphere_cloud_controller_image_tag: "latest"
vsphere_syncer_image_tag: "v1.0.2"
vsphere_csi_attacher_image_tag: "v1.1.1"
vsphere_csi_controller: "v1.0.2"
vsphere_csi_liveness_prove_image_tag: "v1.1.0"
vsphere_csi_provisioner_image_tag: "v1.2.2"
vsphere_csi_node_driver_registrar_image_tag: "v1.1.0"
vsphere_csi_driver_image_tag: "v1.0.2"
vsphere_csi_controller_replicas: 1
vsphere_csi_enabled: true
Класс хранилища
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: fast
provisioner: kubernetes.io/vsphere-volume
parameters:
datastore: LAB
diskformat: thin
fsttype: ext4
Требование постоянного тома
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: test
namespace: kube-system
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
storageClassName: fast