🔧 Fixing a Kubernetes Namespace Stuck in the “Terminating” State

🔧 Fixing a Kubernetes Namespace Stuck in the “Terminating” State

A quick guide for DevOps & Platform Engineers


🚨 The Problem

Have you ever tried deleting a Kubernetes namespace and found it stuck like this?

When you run:

You see:

C


🔍 Root Cause: Finalizers

Kubernetes uses finalizers to safely clean up resources before deletion. If a finalizer (like kubernetes) fails or hangs, the deletion process never completes.


🧹 The Fix — Manually Remove the Finalizer


✅ Step 1: Get the stuck namespace


✅ Step 2: Edit tmp.json

Delete the finalizers block or make it empty:


✅ Step 3: Start the proxy server

👉 Keep this terminal open.


✅ Step 4: Finalize the deletion

Open a new terminal:


✅ Step 5: Confirm it's gone

✅ Namespace successfully deleted!


🧠 Extra Notes

  • This works on AKS, EKS, GKE, or any Kubernetes cluster.

  • Ideal for dev/test environments. In prod, investigate root causes (stuck CRDs, webhooks, etc.).

  • Automate cleanup for safer operations.


📌 Save this for later & Share with your team

Follow for more real-world Kubernetes fixes

👇 #Kubernetes #DevOps #CloudNative #K8sTips #AKS #PlatformEngineering #Finalizers

Or simply "kubectl edit namespace <your-namespace>" and delete the finalizers block

To view or add a comment, sign in

Others also viewed

Explore topics