Category | kubernetes |
Added on | 2020-04-23 |
Source | source |
kubectl get pods | ag <search term here> | cut -d' ' -f 1 | xargs -I {} kubectl delete pods/{}
Handy func:
func kubectl:delete-pods() {
local search
search="$1"
kubectl get pods | ag "$search" | cut -d' ' -f 1 | xargs -I {} kubectl delete pods/{}
}
Lots of pods? Try:
# 2 workers, interactive, same order
kubectl get pods | ag "$search" | cut -d' ' -f 1 | parallel -j 2 -k --interactive kubectl delete pod
# 2 workers, same order
kubectl get pods | ag "$search" | cut -d' ' -f 1 | parallel -j 2 -k kubectl delete pod ```