乔克叔叔的博客,公众号:运维开发故事

kubernetes中批量删除evicted状态的pod

#!/bin/bash

# get namespace
namespaces=`kubectl get pod -A | grep -i "evicted" | awk '{print $1}'`
for namespace in ${namespaces}
do
    kubectl get pod -n ${namespace} |grep -i "evicted"|awk '{print $1}' | xargs kubectl delete pod -n ${namespace}
done
posted @ 2020-06-23 09:50  乔克爱运维  阅读(956)  评论(0编辑  收藏  举报