系统环境

  • Kubernetes 版本:1.20.4 (二进制安装)

查看报错

[root@k8s-master ~]# kubectl get pvc
NAME         STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS          AGE
test-claim   Pending                                      managed-nfs-storage   5s
[root@k8s-master ~]# 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 "nfs-storage-231" or manually created by system administrator

修改apiserver的配置

二进制安装和kubeadm安装的apiserver配置文件路径不同,根据实际情况修改

[root@k8s-master ~]# cat /opt/kubernetes/cfg/kube-apiserver.conf
...
--proxy-client-key-file=/opt/kubernetes/ssl/server-key.pem \
--feature-gates=RemoveSelfLink=false \ #添加这个配置
--requestheader-allowed-names=kubernetes \
...

# 重启apiserver
[root@k8s-master ~]# systemctl restart kube-apiserver.service 

查看pvc状态

PVC正常绑定

[root@k8s-master ~]# kubectl get pvc
NAME                     STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS          AGE
test-claim1              Bound    pvc-54172573-1b09-422d-b101-2bf4be905476   1Gi        RWX            managed-nfs-storage   26m
文章作者: 鲜花的主人
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 爱吃可爱多
Kubernetes Kubernetes
喜欢就支持一下吧
打赏
微信 微信
支付宝 支付宝