我一直在研究CSI / CNS,以使其正常运行,但是它从不访问数据存储。 我会一遍又一遍地遵循https://cloud-provider-vsphere.sigs.k8s.io/tutorials/kubernetes-on-vsphere-with-kubeadm.html中的所有说明,但每次都会遇到相同的问题。
我的安装是如此顺利,在安装过程中我没有遇到任何问题,但是当我部署测试应用程序以查看结果时,永远无法创建该卷。
如果有人可以帮助我解决问题,我将非常感激。
ubuntu@stg-master1:~$ kubectl describe pvc
Name: mongodb-persistent-storage-claim-mongod-0
Namespace: default
StorageClass: mongodb-sc
Status: Pending
Volume:
Labels: environment=test
replicaset=MainRepSet
role=mongo
Annotations: volume.beta.kubernetes.io/storage-class: mongodb-sc
volume.beta.kubernetes.io/storage-provisioner: csi.vsphere.vmware.com
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Provisioning 109s (x8 over 3m56s) csi.vsphere.vmware.com_stg-master1_2eb0be9e-1bfd-11ea-91ec-005056a6d84f External provisioner is provisioning volume for claim "default/mongodb-persistent-storage-claim-mongod-0"
Warning ProvisioningFailed 109s (x8 over 3m56s) csi.vsphere.vmware.com_stg-master1_2eb0be9e-1bfd-11ea-91ec-005056a6d84f failed to provision volume with StorageClass "mongodb-sc": rpc error: code = Internal desc = Failed to get shared datastores in kubernetes cluster. Error: Empty List of Node VMs returned from nodeManager
Normal ExternalProvisioning 11s (x16 over 3m56s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "csi.vsphere.vmware.com" or manually created by system administrator
Mounted By: mongod-0
ubuntu@stg-master1:~$
ubuntu@stg-master1:~$ kubectl describe pod mongod-0
Name: mongod-0
Namespace: default
Priority: 0
PriorityClassName: <none>
Node: <none>
Labels: controller-revision-hash=mongod-b4564d9dd
environment=test
replicaset=MainRepSet
role=mongo
statefulset.kubernetes.io/pod-name=mongod-0
Annotations: <none>
Status: Pending
IP:
Controlled By: StatefulSet/mongod
Containers:
mongod-container:
Image: mongo:3.4
Port: 27017/TCP
Host Port: 0/TCP
Command:
numactl
--interleave=all
mongod
--bind_ip
0.0.0.0
--replSet
MainRepSet
--auth
--clusterAuthMode
keyFile
--keyFile
/etc/secrets-volume/internal-auth-mongodb-keyfile
--setParameter
authenticationMechanisms=SCRAM-SHA-1
Requests:
cpu: 200m
memory: 200Mi
Environment: <none>
Mounts:
/data/db from mongodb-persistent-storage-claim (rw)
/etc/secrets-volume from secrets-volume (ro)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-kr9br (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
mongodb-persistent-storage-claim:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: mongodb-persistent-storage-claim-mongod-0
ReadOnly: false
secrets-volume:
Type: Secret (a volume populated by a Secret)
SecretName: shared-bootstrap-data
Optional: false
default-token-kr9br:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-kr9br
Optional: false
QoS Class: Burstable
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 78s (x13 over 16m) default-scheduler pod has unbound immediate PersistentVolumeClaims (repeated 3 times)
ubuntu@stg-master1:~$
答案 0 :(得分:0)
我发现了问题;缺少磁盘UUID定义。
apiVersion: storage.k8s.io/v1 metadata: name: mongodb-sc annotations: storageclass.kubernetes.io/is-default-class: "true" provisioner: csi.vsphere.vmware.com parameters: storagepolicyname: "Space-Efficient" fstype: ext4