0

I created storageclass and persistentvolumeclaim in the vSphere infrastructure. However, I am getting an error when I checked persistentvolumeclaim using kubectl describe pvc pvc-name command:

[root@kube-master-01 ~]# kubectl describe pvc jenkins-claim -n kube-jenkins
Name:          jenkins-claim
Namespace:     kube-jenkins
StorageClass:  fast
Status:        Pending
Volume:
Labels:        <none>
Annotations:   kubectl.kubernetes.io/last-applied-configuration:
                 {"apiVersion":"v1","kind":"PersistentVolumeClaim","metadata":{"annotations":{"volume.beta.kubernetes.io/storage-class":"fast"},"name":"jen...
               volume.beta.kubernetes.io/storage-class: fast
               volume.beta.kubernetes.io/storage-provisioner: kubernetes.io/vsphere-volume
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode:    Filesystem
Mounted By:    <none>
Events:
  Type     Reason              Age                    From                         Message
  ----     ------              ----                   ----                         -------
  Warning  ProvisioningFailed  2m42s (x701 over 26h)  persistentvolume-controller  Failed to provision volume with StorageClass "fast": Cloud provider not initialized properly

The storageclass.yml and persistentvolumeclaim.yml used is as followings:

apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: fast
provisioner: kubernetes.io/vsphere-volume
parameters:
  datastore: VSANDatastore
  diskformat: thin
  fstype: xfs

The persistentvolumeclaim.yml:

kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: jenkins-claim
  annotations:
    volume.beta.kubernetes.io/storage-class: fast
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5G

This problem occurs frequently in VMware vSphere environment.

  • Look at the logs of your kubelet – Kartoch Apr 05 '20 at 14:42
  • **The kubelet log is as shown:** `[root@kube-master-01 ssl]# journalctl -u kubelet | grep cloud Mar 27 17:48:24 kube-master-01 kubelet[1974]: I0327 17:48:24.175454 1974 flags.go:33] FLAG: --cloud-config="" Mar 27 17:48:24 kube-master-01 kubelet[1974]: I0327 17:48:24.175462 1974 flags.go:33] FLAG: --cloud-provider="" Mar 27 17:48:24 kube-master-01 kubelet[1974]: I0327 17:48:24.301258 1974 plugins.go:100] No cloud provider specified. Mar 27 17:48:24 kube-master-01 kubelet[1974]: I0327 17:48:24.301286 1974 server.go:526] No cloud provider specified: "" from the config file: "" ` – thenextgeneration Apr 05 '20 at 15:17
  • My kubernetes installation method is kubespray. In which file should I specify the cloud provider? – thenextgeneration Apr 05 '20 at 15:22
  • 1
    Please take a look here: [Kubespray - vSphere Cloud Provider](https://github.com/kubernetes-sigs/kubespray/blob/646fd5f47b931c073247e355f911bda5974745f3/docs/vsphere.md#vsphere-cloud-provider) Did you followed this step by step to create your PV? – Will R.O.F. Apr 06 '20 at 12:55
  • Hi Yes, I did it step by step. I think that I also have a datastore problem in VMware vSphere. I could not configure it correctly. I continue looking for it on the internet. – thenextgeneration Apr 06 '20 at 20:18
  • I'd like to provide a few links that could help you solve your vSphere issue, for vSphere >= 6.7U3: The [External vSphere Cloud Provider](https://github.com/kubernetes/cloud-provider-vsphere) along with [vSphere Container Storage Interface Driver](https://github.com/kubernetes-sigs/vsphere-csi-driver) are recommended, and you can learn more on [vSphere Kubernetes Documentation](https://cloud-provider-vsphere.sigs.k8s.io/). For vSphere < 6.7U3 see [Running a Kubernetes Cluster on vSphere with kubeadm](https://cloud-provider-vsphere.sigs.k8s.io/tutorials/k8s-vcp-on-vsphere-with-kubeadm.html) – Will R.O.F. Apr 10 '20 at 11:12

0 Answers0