DigitalOcean pod has unbound immediate PersistentVolumeClaims

狂风中的少年 提交于 2019-12-04 06:52:52

This:

no storage class is set

And an empty output for kubectl describe sc means that there's no storage class.

I recommend installing the CSI-driver for Digital Ocean. That will create a do-block-storage class using the Kubernetes CSI interface.

Another option is to use local storage. Using a local storage class:

$ cat <<EOF
kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
EOF | kubectl apply -f -

Then for either case you may need to set it as a default storage class if you don't specify storageClassName in your PVC:

$ kubectl patch storageclass local-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

or

$ kubectl patch storageclass do-block-storage -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'

It is a statefulSet using PersistentVolumeClaims

You need to configure a default storageClass in your cluster so that the PersistentVolumeClaim can take the storage from there.

In minikube one is already available so it succeeds without error:

C02W84XMHTD5:ucp iahmad$ kubectl get sc --all-namespaces 
NAME                 PROVISIONER                AGE
standard (default)   k8s.io/minikube-hostpath   7d
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!