K8s 1.23.x版本nfs持久存储报错 persistentvolume-controller waiting for a volume to be created, either by ext
最近在學(xué)習k8s的相關(guān)知識,嗯,出現(xiàn)一些問題,記錄下。
說明
Docker 20.10.12
kubeadm-v1.23.4
kubelet-v1.23.4
kubectl-v1.23.4
對,需要對volume,pv,pvc有了解哈
在使用nfs持久化存儲這塊出現(xiàn)的問題
nfs的k8s持久化存儲的插件:https://github.com/kubernetes-retired/external-storage/tree/master/nfs
問題及解決
在創(chuàng)建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-nfsvolume.beta.kubernetes.io/storage-provisioner: example.com/nfsvolume.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 administratorNormal 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狀態(tài)
去查了一下,解決方式:
修改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
額,到這把。。
總結(jié)
以上是生活随笔為你收集整理的K8s 1.23.x版本nfs持久存储报错 persistentvolume-controller waiting for a volume to be created, either by ext的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 时间格式化hh:mm:ss和HH:mm:
- 下一篇: js验证电话号码(包括手机,固定电话,带