k8s中强制删除pv
K8s 集群内有一个已经不再使用的 PV,虽然已经删除了与其关联的 Pod 及 PVC,并对其执行了删除命令,但仍无法正常删除,一直处于 Terminating 状态:[root@k8s-master share]# kubectl get pvNAMECAPACITYACCESS MODESRECLAIM POLICYSTATUSCLAIM
·
K8s 集群内有一个已经不再使用的 PV,虽然已经删除了与其关联的 Pod 及 PVC,并对其执行了删除命令,但仍无法正常删除,一直处于 Terminating 状态:
[root@k8s-master share]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
nfs-pv-kuboard-nfs 20G RWX Retain Terminating kube-system/nfs-pvc-kuboard-nfs nfs-storageclass-provisioner 19h
nfs-pv-storage-nfs 10G RWX Retain Terminating kube-system/nfs-pvc-storage-nfs nfs-storageclass-provisioner 16h
pvc-908de6c6-40d8-460c-97bd-38ac1799b677 10G RWX Delete Bound default/test-claim managed-nfs-storage 35m
解决办法:
[root@k8s-master share]# kubectl patch pv nfs-pv-storage-nfs -p '{"metadata":{"finalizers":null}}'
persistentvolume/nfs-pv-storage-nfs patched
[root@k8s-master share]# kubectl patch pv nfs-pv-kuboard-nfs -p '{"metadata":{"finalizers":null}}'
persistentvolume/nfs-pv-kuboard-nfs patched
[root@k8s-master share]# kubectl get pv
NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
pvc-908de6c6-40d8-460c-97bd-38ac1799b677 10G RWX Delete Bound default/test-claim managed-nfs-storage 36m
更多推荐
已为社区贡献19条内容
所有评论(0)