用户工具

站点工具


cmd:k8s

删除被驱逐的 pod

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod

删除所有被驱逐的 pod(所有 namespace)

keyword="Evicted"

namespaces=`kubectl get namespaces | awk '{print $1}' | grep -v NAME`

for namespace in $namespaces
do
    echo "cleaning $keyword pod in $namespace"
    kubectl delete pod $(kubectl get pods -n $namespace | grep $keyword | awk '{print $1}') -n $namespace
done

查看所有命名空间的 pod

k get po --all-namespaces
cmd/k8s.txt · 最后更改: 2020/11/12 16:40 由 plough

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki