How do I troubleshoot namespaces in a terminated state in my Amazon EKS cluster?

Last updated: 2022-10-20

I tried to delete a namespace in my Amazon Elastic Kubernetes Service (Amazon EKS) cluster. However, the namespace is stuck in the "Terminating" status.

Short description

To delete a namespace, Kubernetes must first delete all the resources in the namespace. Then, it must check registered API services for the status. A namespace gets stuck in "Terminating" status for the following reasons:

  • The namespace contains resources that Kubernetes can't delete.
  • An API service has a "False" status.


Follow these instructions to delete namespaces that are stuck in the "Terminating" status.

1.    Save a JSON file similar to the following:

kubectl get namespace <terminating-namespace> -o json > tempfile.json

2.    Remove the finalizers array block from the spec section of the JSON file. The following is an example of the spec section of a JSON file that contains the finalizers array block to remove:

"spec": {
        "finalizers": [

After removing the finalizers array block, the spec section of the JSON file looks like this:

"spec" : {

3.    To apply the changes, run a command similar to the following:

kubectl replace --raw "/api/v1/namespaces/<terminating-namespace>/finalize" -f ./tempfile.json

4.    Verify that the terminating namespace is removed:

kubectl get namespaces

Repeat these steps for any remaining namespaces stuck in the "Terminating" status.

Did this article help?

Do you need billing or technical support?