Skip to content

Instantly share code, notes, and snippets.

@jujhars13
Last active July 25, 2022 13:42
Show Gist options
  • Save jujhars13/662821713182f790a72316bc4a342b0c to your computer and use it in GitHub Desktop.
Save jujhars13/662821713182f790a72316bc4a342b0c to your computer and use it in GitHub Desktop.
deleting kubernetes namespaces that are stuck in "Terminating..."
#!/bin/bash
# Thanks to https://medium.com/@craignewtondev/how-to-fix-kubernetes-namespace-deleting-stuck-in-terminating-state-5ed75792647e
# NB this can be dangerous, so use sparingly
export ns=broken-app; kubectl get ns "${ns}" -o json | sed s/\"kubernetes\"//g | kubectl replace --raw /api/v1/namespaces/"${ns}"/finalize -f -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment