When attempting to delete a Kubernetes namespace, you might occasionally find it stuck in the Terminating
state which is very annoying. This can happen for several reasons, including resources within the namespace that haven't been cleaned up properly, often due to finalizers. This tutorial provides a step-by-step video on how to address this issue using the namespace example-ns
as an example.
You can also read the full blog post related to this topic:
https://devoriales.com/post/332/resolve-stuck-namespaces-in-kubernetes-a-step-by-step-tutorial
The command to get all the resources in a namespace, including Custom Resource Definitions:
kubectl get $(kubectl api-resources --verbs=list --namespaced -o name | awk NF | paste -sd "," -) -n example-ns --ignore-not-found