How to delete a namespace

I’m evaluating RKE and so far I’m quite excited, such a big step from minikube. But when I tried to delete a namespace, kubectl got stuck. I thought I deleted everything in there and couldn’t figure out what was wrong, so I panicked and deleted the cluster and started over. This did fix my problem; however, I can’t do this in production. I do see some workarounds to use kubectl to do something with the finalizer. Is deleting namespaces generally not recommended in Kubernetes? Or is this something to do with RKE?

The finalizer is supposed to finish and remove itself so that the namespace can be deleted. Removing it yourself is the manual version of forcing that. Deleting namespaces you made is generally fine; the ones that were already there generally have important things in them… Not much more to say without knowing which one you deleted or what logs say about it not completing.

Vincent,

Thanks for getting back to me. Yes this was a namespace I created. After my bad experience, I’ve stuck to a practice of not removing namespaces. If I try it again and kubectl hangs, I’ll try to post some logs.

I have a similar issue. New to Rancher though, so not entirely sure what is good to post. Essentially, I’m playing with a small 5 node cluster, and have several namespaces that don’t ever completely remove. I’ve read in several places that editing out a “finalizer” will complete the operation, but it does not.

Here is an example of one that will not delete:

$ kubectl get pods -n default | grep jupyter
$ 
$ kubectl logs jupyterhub-p-86wpl -n default
Error from server (NotFound): pods "jupyterhub-p-86wpl" not found

Any help will be really appreciated, the kubernetes learning curve is steep!