Delete namespace stuck in Terminating State

Delete namespace stuck in Terminating State

by | 02.10.2021 | Tutorial

Deleting a namespace is just a line of command, but when it is stuck in a Terminating state it starts to give you a headache. In this small tutorial, we would go on to how to delete a namespace that’s stuck. 

What’s is a stuck Namespace?

Whenever you find your Namespace getting stuck to a terminating state for long periods of time with kubectl delete namespace name_of_namespace, we call that a stuck namespace.

Delete namespace stuck in Terminating State
abcdsandbox is stucked namespace

Delete Namespace stuck in Terminating State

The straightforward way is to use the following command on the terminal and replace the terminating-namespace with the Namespace you want to delete. For this post, we’re targeting abcdsandbox.

forcefully delete namespace
Delete Terminating Namespace

The benefit of this approach:

  1. You don’t need to spin kubeproxy and deal with dependency errors in isolated environments.
  2. Works when there is no node in the cluster
  3. This approach supports a wide range of kubectl versions.
Delete namespace stuck in Terminating State
Terminating Namespace Deleted

Drawbacks

The only drawback of this approach is this it doesn’t work on a namespace with Active Status. kubectl delete namespace name_of_namespace works well, and there won’t be a need for using this powerful command for that.

Thanks for reading this post! Feel free to share it with your friends/colleagues if this was of any help!

Read more from us:

CommunityNew

The DevOps Awareness Program

Subscribe to the newsletter

Join 100+ cloud native ethusiasts

#wearep3r

Join the community Slack

Discuss all things Kubernetes, DevOps and Cloud Native

Related articles6

How to Delete all Pods in ReplicaSet

How to Delete all Pods in ReplicaSet

When administering your Kubernetes cluster, you will likely run into a situation where you need to delete pods from one of your ReplicaSet. You may need to debug issues with the ReplicaSet itself, or other reasons.

How to Install Portainer on Remote Server ft. VSCode?

How to Install Portainer on Remote Server ft. VSCode?

Portainer is one of the most popular and trusted GUI for managing Docker, Swarms, ACIs and Kubernetes. The company boasts on its’ website for having 500K users, and there’s no doubt to the number looking at how easy it makes managing the tools. This post goes on the...

How To Install Docker on Ubuntu 20.04?

How To Install Docker on Ubuntu 20.04?

Docker is an open-source tool that makes managing application processes in containers much easier. Containers allow you to run your programmes in separate processes with their own resources. Containers are comparable to virtual machines, except they're more portable,...