This page shows you how to resolve issues with a namespace stuck in the
Terminating state.
Namespaces use Kubernetes finalizers
to prevent deletion if one or more resources within a namespace still exist.
When you delete a namespace using the kubectl delete command, the namespace
enters the Terminating state.
The namespace stays in the Terminating state
until Kubernetes deletes its dependent resources
and clears all finalizers. The namespace lifecycle controller first lists all
resources in the namespace that GKE needs to delete.
If GKE can't delete a dependent resource,
or if the namespace
lifecycle controller can't verify that the namespace is empty, then the namespace
remains in the Terminating state until you resolve the issue.
To resolve a namespace stuck in the Terminating state, identify
and remove any unhealthy components blocking the deletion. Try these solutions
in order:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[],[],null,["# Troubleshoot namespace stuck in the Terminating state\n\n[Autopilot](/kubernetes-engine/docs/concepts/autopilot-overview) [Standard](/kubernetes-engine/docs/concepts/choose-cluster-mode)\n\n*** ** * ** ***\n\nThis page shows you how to resolve issues with a namespace stuck in the\n`Terminating` state.\n\nNamespaces use Kubernetes [finalizers](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/#finalizers)\nto prevent deletion if one or more resources within a namespace still exist.\nWhen you delete a namespace using the `kubectl delete` command, the namespace\nenters the `Terminating` state.\nThe namespace stays in the `Terminating` state\nuntil Kubernetes deletes its dependent resources\nand clears all finalizers. The namespace lifecycle controller first lists all\nresources in the namespace that GKE needs to delete.\n\nIf GKE can't delete a dependent resource,\nor if the namespace\nlifecycle controller can't verify that the namespace is empty, then the namespace\nremains in the `Terminating` state until you resolve the issue.\n\nTo resolve a namespace stuck in the `Terminating` state, identify\nand remove any unhealthy components blocking the deletion. Try these solutions\nin order:\n\n1. [Find and remove unavailable API services](#unavailable-api-services).\n2. [Find and remove remaining resources](#remove_resource).\n3. [Force delete the namespace](#force-delete-namespace).\n\nFind and remove unavailable API services\n----------------------------------------\n\n1. List unavailable API services:\n\n kubectl get apiservice | grep False\n\n2. Troubleshoot any unresponsive services:\n\n kubectl describe apiservice \u003cvar translate=\"no\"\u003eAPI_SERVICE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eAPI_SERVICE\u003c/var\u003e with the name of the unresponsive\n service.\n3. Check if the status of the namespace is still `Terminating`:\n\n kubectl get ns | grep Terminating\n\nFind and remove remaining resources\n-----------------------------------\n\n1. List all the resources remaining in the terminating namespace:\n\n kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e with the name of the namespace you\n want to delete.\n2. Remove any resources displayed in the output.\n\n3. Check if the status of the namespace is still `Terminating`:\n\n kubectl get ns | grep Terminating\n\nForce delete the namespace\n--------------------------\n\n| **Caution:** Use the solution in this section only as a last resort if the previous solutions don't work. Force deleting a namespace could result in resources remaining in your cluster that you can't access.\n\nRemove the finalizers blocking namespace deletion to force the namespace\nto terminate:\n\n1. Save the namespace manifest as a YAML file:\n\n kubectl get ns \u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e -o yaml \u003e ns-terminating.yml\n\n2. Open the manifest in a text editor and remove all values in the\n `spec.finalizers` field:\n\n vi ns-terminating.yml\n\n3. Verify that the finalizers field is empty:\n\n cat ns-terminating.yml\n\n The output should look similar to the following: \n\n apiVersion: v1\n kind: Namespace\n metadata:\n annotations:\n name: \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-l devsite-syntax-l-Scalar devsite-syntax-l-Scalar-Plain\"\u003eNAMESPACE\u003c/span\u003e\u003c/var\u003e\n spec:\n finalizers:\n status:\n phase: Terminating\n\n4. Start an HTTP proxy to access the Kubernetes API:\n\n kubectl proxy\n\n5. Replace the namespace manifest using `curl`:\n\n curl -H \"Content-Type: application/yaml\" -X PUT --data-binary @ns-terminating.yml http://127.0.0.1:8001/api/v1/namespaces/\u003cvar translate=\"no\"\u003eNAMESPACE\u003c/var\u003e/finalize\n\n6. Check if the status of the namespace is still `Terminating`:\n\n kubectl get ns | grep Terminating\n\nWhat's next\n-----------\n\n- If you can't find a solution to your problem in the documentation, see\n [Get support](/kubernetes-engine/docs/getting-support) for further help,\n including advice on the following topics:\n\n - Opening a support case by contacting [Cloud Customer Care](/support-hub).\n - Getting support from the community by [asking questions on StackOverflow](http://stackoverflow.com/questions/tagged/google-kubernetes-engine) and using the `google-kubernetes-engine` tag to search for similar issues. You can also join the [`#kubernetes-engine` Slack channel](https://googlecloud-community.slack.com/messages/C0B9GKTKJ/) for more community support.\n - Opening bugs or feature requests by using the [public issue tracker](/support/docs/issue-trackers)."]]