直接改完后保存
然后强制删除pvc
[root@k8s-master01 ~]# kubectl delete -f nfs-pvc001.yaml
persistentvolumeclaim "nfs-pvc001" deleted
^C
[root@k8s-master01 ~]#
[root@k8s-master01 ~]#
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
nfs-pvc001 Terminating nfs-pv001 600Gi RWX nfs 70m
[root@k8s-master01 ~]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
nfs-pvc001 Terminating nfs-pv001 600Gi RWX nfs 70m
[root@k8s-master01 ~]# kubectl patch pvc nfs-pvc001 -p '{"metadata":{"finalizers":null}}'
persistentvolumeclaim/nfs-pvc001 patched
[root@k8s-master01 ~]# kubectl get pvc
No resources found.
删除成功
[root@k8s-master01 ~]#
[root@k8s-master01 ~]#
[root@k8s-master01 ~]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs-pv001 800Gi RWX Recycle Released default/nfs-pvc001 nfs 74m
[root@k8s-master01 ~]# vim nfs-pvc001.yaml 修改容量大小
[root@k8s-master01 ~]# kubectl apply -f nfs-pvc001.yaml
persistentvolumeclaim/nfs-pvc001 created
[root@k8s-master01 ~]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs-pv001 800Gi RWX Recycle Released default/nfs-pvc001 nfs 75m
最后PV状态悲剧了Released
[root@k8s-master01 ~]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
nfs-pvc001 Pending nfs 9s
[root@k8s-master01 ~]# kubectl get pvc
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
nfs-pvc001 Bound nfs-pv001 800Gi RWX nfs 3m33s
[root@k8s-master01 ~]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs-pv001 800Gi RWX Recycle Bound default/nfs-pvc001 nfs 78m
[root@k8s-master01 ~]#
最后把PV下面红框的删掉,保存即可恢复正常,原来的图片资源还在