K8s 1.23版本nfs创建动态存储报错 persistentvolume-controller waiting for a volume to be created, either by external provisioner "qgg-nfs-storage" or manually created by system administrator

查看状态(Pending)

[root@k8s-matser01 nfs.rbac]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
default test-claim Pending managed-nfs-storage 4s

查看报错

[root@k8s-matser01 nfs.rbac]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
test-claim Pending managed-nfs-storage 5s
[root@k8s-matser01 nfs.rbac]# kubectl describe pvc test-claim
Name: test-claim
Namespace: default
StorageClass: managed-nfs-storage
Status: Pending
Volume:
Labels: <none>
Annotations: volume.beta.kubernetes.io/storage-class: managed-nfs-storage
volume.beta.kubernetes.io/storage-provisioner: qgg-nfs-storage
Finalizers: [kubernetes.io/pvc-protection]
Capacity:
Access Modes:
VolumeMode: Filesystem
Used By: <none>
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal ExternalProvisioning 8s (x2 over 13s) persistentvolume-controller waiting for a volume to be created, either by external provisioner "qgg-nfs-storage" or manually created by system administrator

解决(修改apiserver的配置)

[root@k8s-matser01 nfs.rbac]# cat /etc/kubernetes/manifests/kube-apiserver.yaml
apiVersion: v1
-----
- --tls-private-key-file=/etc/kubernetes/pki/apiserver.key
- --feature-gates=RemoveSelfLink=false # 添加这个配置

验证

### 重启apiserver
systemctl restart kubelet

[root@k8s-matser01 nfs.rbac]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
test-claim Bound pvc-c113b86d-7eb2-4a2e-a905-582241f5396a 1Mi RWX managed-nfs-storage 13m