一般删除步骤为:先删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

相关文章:

  • 2022-01-18
  • 2021-06-12
  • 2021-11-04
  • 2022-12-23
  • 2021-10-08
  • 2022-12-23
  • 2021-09-12
  • 2021-12-06
猜你喜欢
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2022-01-28
相关资源
相似解决方案