k8s批量删除Evicted Pods

2026-03-25

k8s批量删除Evicted Pods

1、Evicted
kubectl get pods -n default | grep Evicted |awk '{print $1}'|xargs kubectl delete pods -n default

PS: kubectl -n kube-system get pods #指定pod所在的命名空间
执行完成后,成功删除全部Evicted状态的Pods

2、kubectl scale deployment myapp --replicas=0

3、kubectl delete pods --all -n

4、kubectl delete pod --grace-period=0 --force

5、Pending
kubectl get pods -n default| grep Pending |awk '{print $1}'|xargs kubectl delete pods -n default

6、Error
kubectl -n crm get pods | grep Error |awk '{print $1}' | xargs kubectl delete pods -n crm

7、cronjob
kubectl delete cronjob webcall-log-cleaner -n default

kubectl get cronjob

分类:Linux | 标签: |

相关日志

评论被关闭!