遇到的问题
pvc始终处于“Terminating”状态,而且删不掉

[root@k8s-master ops]# kubectl get  pvc -n kube-ops
NAME     STATUS        VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
opspvc   Terminating   opspv    20Gi       RWX                           15m
[root@k8s-master ops]# kubectl get  pv | grep ops
opspv                                                                               20Gi       RWX            Delete           Terminating   kube-ops/opspvc

解决方法:

直接删除k8s中的记录:


[root@k8s-master ops]# kubectl patch pv opspv -p '{"metadata":{"finalizers":null}}'
persistentvolume/opspv patched
[root@k8s-master ops]# kubectl get  pv | grep ops
[root@k8s-master ops]# kubectl get  pvc -n kube-ops
NAME     STATUS        VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
opspvc   Terminating   opspv    0                                        17m
[root@k8s-master ops]# kubectl delete pvc opspvc  -n kube-ops
persistentvolumeclaim "opspvc" deleted
Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐