Last active
April 15, 2020 13:45
-
-
Save danhigham/12d3cdf79dd3b1b1966698a69b77c770 to your computer and use it in GitHub Desktop.
Dan's handy kubectl one liners
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
# Remove all replicasets with 0 pods | |
for i in $(kubectl get rs -o json | jq -r '.items[] | select(.status.replicas==0) | .metadata.name'); do kubectl delete rs/$i; done | |
# Remove all resources with a certain label set | |
for i in $(kubectl api-resources -o name); do for x in $(kubectl get $i -l "kapp.k14s.io/app=1586922989415912400" -o name); do kubectl delete $x; done; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment