Sometimes kubernetes namespaces just want to act up. And for whatever reason they get stuck on Terminating state after deletion, or at least after executing the kubectl delete command.

However, finalizers are here to help. This command will force finalize the stuck in terminating state namespace.

kubectl get namespace "<name-of-namespace>" -o json \
  | tr -d "\n" | sed "s/\"finalizers\": \[[^]]\+\]/\"finalizers\": []/" \
  | kubectl replace --raw /api/v1/namespaces/<name-of-namespace>/finalize -f -

*Just replace ‘name-of-namespace’ with the name of your the namespace hhh