Skip to content

Instantly share code, notes, and snippets.

@ptesny
Forked from superbrothers/kubectl-delete_all
Created September 2, 2020 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ptesny/e21a2a6d47755497b624ecc3063de201 to your computer and use it in GitHub Desktop.
Save ptesny/e21a2a6d47755497b624ecc3063de201 to your computer and use it in GitHub Desktop.
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
#!/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