Quick Post:
Cause: This is because of a stuck resource in kubernetes.
Solution: One way to get around this is to remove the finalizer spec to allow kubernetes in to clean-up the namespace.
Steps:
- Dump the namespace spec in json format
kubectl get ns <namespace to remove> -o json > namespace.json
- Edit the namespace.json and remove the finalizer portion in the spec. it should look like below
From:
to:
- Manually patch the namespace using the following command
kubectl replace --raw "/api/v1/namespaces/<NAMESPACE NAME>/finalize" -f namespace.json
… and that’s it. Hope that helps 🙂
And get orphaned objects belonging to that namespace?