Kubernetes Pod 卡在 Terminating 的定位与修复
kubectl delete pod 后 Pod 长时间处于 Terminating,无法删除,也可能阻塞命名空间删除或节点维护。
kubectl get pod <pod> -n <ns> -o yaml
kubectl describe pod <pod> -n <ns>
kubectl get pod <pod> -n <ns> -o jsonpath='{.metadata.finalizers}'
kubectl get events -n <ns> --sort-by=.lastTimestamp | tail -20
节点:
systemctl status kubelet
journalctl -u kubelet --since '30 min ago' | grep -i -E 'terminat|unmount|volume'
--force --grace-period=0 是最后手段,可能留下孤儿资源。terminationGracePeriodSeconds 和信号处理。kubectl — Pod 状态与事件journalctl — kubelet 日志crictl — 容器运行时