记一次批量删除Evicted状态的pod

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了记一次批量删除Evicted状态的pod相关的知识,希望对你有一定的参考价值。

由于node节点资源不足,造成资源的争抢,并出现大量的驱逐的pod,可以使用grep Evicted查看哪些pod

[root@k8s-master istio-1.4.2]# kubectl get pods -n istio-system | grep Evicted 
grafana-6b65874977-2w54r                  0/1     Evicted   0          21m
grafana-6b65874977-pcctb                  0/1     Evicted   0          21m
grafana-6b65874977-s6mkb                  0/1     Evicted   0          29m
istio-galley-5fc6d6c45b-tlbzs             0/1     Evicted   0          25m
istio-ingressgateway-6d759478d8-c8psq     0/1     Evicted   0          28m
istio-pilot-5c4995d687-5jtwd              0/1     Evicted   0          21m
istio-pilot-5c4995d687-678hg              0/1     Evicted   0          48m
istio-pilot-5c4995d687-bxt8p              0/1     Evicted   0          21m
istio-pilot-5c4995d687-c4zw8              0/1     Evicted   0          21m
istio-pilot-5c4995d687-cv79t              0/1     Evicted   0          21m
istio-pilot-5c4995d687-lwkf8              0/1     Evicted   0          21m
istio-pilot-5c4995d687-q4f5j              0/1     Evicted   0          21m
istio-pilot-5c4995d687-q77r2              0/1     Evicted   0          21m
istio-sidecar-injector-746f7c7bbb-9gv95   0/1     Evicted   0          51m
kiali-8559969566-pfh6t                    0/1     Evicted   0          51m
prometheus-66c5887c86-smcgv               0/1     Evicted   0          51m

针对这么istio-system命名空间下的pod,再找出Evicted的pod,执行delete

[root@k8s-master istio-1.4.2]# kubectl get pods -n istio-system | grep Evicted |awk ‘{print $1}‘ |xargs kubectl -n istio-system delete pod
pod "grafana-6b65874977-2w54r" deleted
pod "grafana-6b65874977-pcctb" deleted
pod "grafana-6b65874977-s6mkb" deleted
pod "istio-galley-5fc6d6c45b-tlbzs" deleted
pod "istio-ingressgateway-6d759478d8-c8psq" deleted
pod "istio-pilot-5c4995d687-5jtwd" deleted
pod "istio-pilot-5c4995d687-678hg" deleted
pod "istio-pilot-5c4995d687-bxt8p" deleted
pod "istio-pilot-5c4995d687-c4zw8" deleted
pod "istio-pilot-5c4995d687-cv79t" deleted
pod "istio-pilot-5c4995d687-lwkf8" deleted
pod "istio-pilot-5c4995d687-q4f5j" deleted
pod "istio-pilot-5c4995d687-q77r2" deleted
pod "istio-sidecar-injector-746f7c7bbb-9gv95" deleted
pod "kiali-8559969566-pfh6t" deleted
pod "prometheus-66c5887c86-smcgv" deleted

以上是关于记一次批量删除Evicted状态的pod的主要内容,如果未能解决你的问题,请参考以下文章

记一次kubernetes Evicted的处理

sh 删除所有Evicted Pods

记一次使用Flannel插件排错历程

记一次虚机强制断电 K8s 集群 etcd pod 挂掉快照丢失(没有备份)问题处理

节点资源不足:临时存储

记一次虚机强制断电 K8s 集群 etcd pod 挂掉快照丢失(没有备份)问题处理