-
-
Save kjm0001/22e60b7ee5400ff9025863cb7e8b7b32 to your computer and use it in GitHub Desktop.
Kubernetes: Delete all objects in the namespace
This file contains hidden or 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
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all |
This file contains hidden or 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
#!/usr/bin/env bash | |
# | |
# kubectl-delete_all is a utility to delete all objects in the namespace. | |
[[ -n "$DEBUG" ]] && set -x | |
set -eou pipefail | |
exec kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is useful - but making it easy to copy and paste - this uses fake namespace just for testing
You can copy and paste below lines your shell to try it out