错误"pod具有未绑定的立即PersistentVolumeClaim".在有状态集部署期间 [英] Error "pod has unbound immediate PersistentVolumeClaim" during statefulset deployment

查看:180
本文介绍了错误"pod具有未绑定的立即PersistentVolumeClaim".在有状态集部署期间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过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

我该如何解决?

推荐答案

pod具有未绑定的立即PersistentVolumeClaims

pod has unbound immediate PersistentVolumeClaims

在这种情况下,pvc无法连接到storageclass,因为它不是作为默认.

In this case pvc could not connect to storageclass because it wasn't make as a default.

根据安装方法,您的Kubernetes群集可能会使用标记为默认值的现有StorageClass进行部署.然后,此默认StorageClass用于为不需要任何特定存储类的PersistentVolumeClaims动态设置存储.有关详细信息,请参见 PersistentVolumeClaim文档.

可用于使您新创建的存储类成为默认存储类的命令.

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".在有状态集部署期间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆