Last active
July 14, 2020 07:59
-
-
Save nataz77/af416d99210ec33ae5ca32af94c0eccd to your computer and use it in GitHub Desktop.
Script to delete failed/evicted pods in system namespaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#Usage: ./kubesystemcleanup.sh | |
namespaces=( "rook-ceph" "ingress-nginx" "cattle-system" "kube-system" "longhorn-system") | |
for n in "${namespaces[@]}" | |
do | |
kubectl get pods -n $n | grep Evicted | awk '{print $1}' | xargs kubectl delete pod -n $n | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment