问题
I am deploying stolon via statefulset (default from stolon repo). I have define in statefulset config
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: stolon-local-storage
resources:
requests:
storage: 1Gi
and here is my storageClass:
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: stolon-local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
statefulset was created fine, but pod has error: pod has unbound immediate PersistentVolumeClaims
How can I resolve it?
回答1:
pod has unbound immediate PersistentVolumeClaims
In this case pvc could not connect to storageclass because it wasn't make as a default.
Depending on the installation method, your Kubernetes cluster may be deployed with an existing StorageClass that is marked as default. This default StorageClass is then used to dynamically provision storage for PersistentVolumeClaims that do not require any specific storage class. See PersistentVolumeClaim documentation for details.
Command which can be used to make your new created storageclass a default one.
kubectl patch storageclass <name_of_storageclass> -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
Then You can use kubectl get storageclass
and it should look like this
NAME PROVISIONER AGE
stolon-local-storage (default) kubernetes.io/gce-pd 1d
来源:https://stackoverflow.com/questions/58607949/error-pod-has-unbound-immediate-persistentvolumeclaim-during-statefulset-deplo