Docs/CloudNative/ErrorProcess/解决Terminating状态的Pod删不掉的问题.md
2022-10-18 16:59:37 +08:00

22 lines
734 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#### 1问题描述
1、最近发现咋 Kubernetes 集群上有个处于 Terminating 状态的 Pod
```
[ec2-user@k8s-master01 ~]$ kubectl get pod -n infra
NAME READY STATUS RESTARTS AGE
jenkins-5c54cf5557-nz4l2 1/1 Terminating 2 (8d ago) 14d
```
2、使用命令删除不动
```
[ec2-user@k8s-master01 ~]$ kubectl delete pod -n infra jenkins-5c54cf5557-nz4l2
pod "jenkins-5c54cf5557-nz4l2" deleted
```
#### 2解决办法
1、无论各种方式生成的 pod, 均可以使用如下命令强制删除:
```
kubectl delete pods <pod> --grace-period=0 --force
```
2、以上pod删除命令如下
```
kubectl delete pod -n infra jenkins-5c54cf5557-nz4l2 --grace-period=0 --force
```