k8s无法删除pv、pvc、pod问题【转】
一般删除步骤为:先删pod再删pvc最后删pv,但是遇到pv始终处于“Terminating”状态,而且delete不掉。
# kubectl get pvc NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE data-redis-cluster-0 Terminating redis-pv3 5Gi RWO redis-cluster 174m
解决方法:
直接删除k8s中的记录:
[root@hchtest redis-sts-master]# kubectl patch pvc data-redis-cluster-0 -p '{"metadata":{"finalizers":null}}' persistentvolumeclaim/data-redis-cluster-0 patched
无法删除pod
pod是与nfs有关,nfs挂载有问题导致pod有问题,执行完删除命令以后看到pod一直处于terminating的状态。
这种情况下可以使用强制删除命令:
kubectl delete pod [pod name] --force --grace-period=0 -n [namespace]
[root@k8s-master nfs]# kubectl delete pod web-7d74df4646-2hjxj --force --grace-period=0 warning: Immediate deletion does not wait for confirmation that the running resource has been terminated. The resource may continue to run on the cluster indefinitely. pod "web-7d74df4646-2hjxj" force deleted [root@k8s-master nfs]# kubectl get pods,pv,pvc -o wide
转自
k8s pv,pvc无法删除问题 - Oops!# - 博客园
https://www.cnblogs.com/weifeng1463/p/11490399.html
(14条消息) k8s删除pod一直处于terminating状态_haohaoxuexiyai的博客-CSDN博客
https://blog.csdn.net/haohaoxuexiyai/article/details/119996961