问题描述
我正在通过statefulset部署stolon(默认值来自stolon回购).我已经在statefulset配置中定义
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
这是我的storageClass:
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创建良好,但pod出现错误: pod具有未绑定的立即PersistentVolume声明
statefulset was created fine, but pod has error:pod has unbound immediate PersistentVolumeClaims
我该如何解决?
推荐答案
在这种情况下,pvc无法连接到storageclass,因为它不是作为默认.
In this case pvc could not connect to storageclass because it wasn't make as a default.
可用于使您新创建的存储类成为默认存储类的命令.
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"}}}'
然后您可以使用kubectl get storageclass
,它应该看起来像这样
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
这篇关于错误"pod具有未绑定的立即PersistentVolumeClaim".在有状态集部署期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!