当前位置:   article > 正文

K8s 1.23.x版本nfs持久存储报错 persistentvolume-controller waiting for a volume to be created, either by ext

persistentvolume-controller waiting for a volume to be created, either by ex

最近在学习k8s的相关知识,嗯,出现一些问题,记录下。

说明

Docker 20.10.12
kubeadm-v1.23.4
kubelet-v1.23.4
kubectl-v1.23.4

对,需要对volume,pv,pvc有了解哈
在使用nfs持久化存储这块出现的问题
nfs的k8s持久化存储的插件:https://github.com/kubernetes-retired/external-storage/tree/master/nfs

问题及解决

在创建pvc报的错

kubectl apply -f my-pvc.yaml
kubectl get pvc

这块有一些问题,就是

[root@k8sm storage]# kubectl describe pvc
Name:          my-pvc
Namespace:     default
StorageClass:  example-nfs
Status:        Pending
Volume:        
Labels:        <none>
Annotations:   control-plane.alpha.kubernetes.io/leader:
                 {"holderIdentity":"7c4527be-a9ea-11ec-93ce-3a41d59f9259","leaseDurationSeconds":15,"acquireTime":"2022-03-22T14:30:27Z","renewTime":"2022-...
               volume.beta.kubernetes.io/storage-class: example-nfs
               volume.beta.kubernetes.io/storage-provisioner: example.com/nfs
               volume.kubernetes.io/storage-provisioner: example.com/nfs
Finalizers:    [kubernetes.io/pvc-protection]
Capacity:      
Access Modes:  
VolumeMode:    Filesystem
Used By:       <none>
Events:
  Type    Reason                Age                 From                         Message
  ----    ------                ----                ----                         -------
  Normal  ExternalProvisioning  11s (x21 over 43s)  persistentvolume-controller  waiting for a volume to be created, either by external provisioner "example.com/nfs" or manually created by system administrator
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21

Normal ExternalProvisioning 11s (x21 over 43s) persistentvolume-controller waiting for a volume to be created, either by external provisioner “example.com/nfs” or manually created by system administrator

一直都在pending状态
去查了一下,解决方式:

修改apiserver的配置

[root@k8sm storage]# vi /etc/kubernetes/manifests/kube-apiserver.yaml
apiVersion: v1
···
    - --tls-private-key-file=/etc/kubernetes/pki/apiserver.key
    - --feature-gates=RemoveSelfLink=false # 添加这个配置
重启下kube-apiserver.yaml
[root@k8sm manifests]# kubectl apply -f kube-apiserver.yaml

[root@k8sm storage]# kubectl get pvc
NAME     STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE
my-pvc   Bound    pvc-ae9f6d4b-fc4c-4e19-8854-7bfa259a3a04   1Mi        RWX            example-nfs    13m
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

就正常了,查了下为什么?
因为原来是1.20版本(我的是1.23.4)默认禁止使用selfLink。
哦,那啥事selfLink?
selfLink:通过API访问资源自身的URL,例如一个Pod的link可能是/api/v1/namespaces/ns36aa8455/pods/sc-cluster-test-1-6bc58d44d6-r8hld

额,到这把。。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/503670
推荐阅读
相关标签
  

闽ICP备14008679号