#!/bin/sh # based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d # delete all evicted pods from all namespaces

kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod

# delete all containers in ImagePullBackOff state from all namespaces

kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod

# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces

kubectl get pods --all-namespaces | grep -E 'ImagePullBackOff|ErrImagePull|Evicted' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod

'나는 노동자 > 이런저런 Tip' 카테고리의 다른 글

redhat subscription yum repo  (0) 2020.01.31
docker image load  (0) 2020.01.22
Jenkins failed job 무시하기  (0) 2019.12.18
absible playbook errors skip  (0) 2019.12.17
ansible Missing sudo password  (0) 2019.12.17

+ Recent posts