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

最近在学习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

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.20版本(我的是1.23.4)默认禁止使用selfLink。
哦,那啥事selfLink?
selfLink:通过API访问资源自身的URL,例如一个Pod的link可能是/api/v1/namespaces/ns36aa8455/pods/sc-cluster-test-1-6bc58d44d6-r8hld

额,到这把。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南巷Dong

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值