How to remove Kubernetes namespaces stuck in a Terminating state

This document (000021065) is provided subject to the disclaimer at the end of this document.


Rancher 2.5.X
Rancher 2.6.X
Rancher 2.7.X


This situation most frequently occurs where a resource still exists within the Namespace with a finalizer that can no longer be satisfied, e.g. a custom resource controlled by an operator, with a finalizer referencing the operator, but where the operator has already been removed from the cluster.
To mitigate a namespace stuck in a terminating state, the following steps should be performed:
1)  Check if any apiservice is unavailable.
2)  Find all resources that still exist for this namespace and remove the finalizers.



1) Check apiservice unavailable

Check if any apiservice is unavailable and hence does not serve its resources.
 kubectl get apiservice|grep False

2) Find resources and remove finalizers

Find all resources that still exist where "$your-ns-to-delete" is the name of the namespace stuck in a terminating state, and remove any finalizer on those resources that can no longer be met.
kubectl api-resources --verbs=list --namespaced -o name | xargs -n 1 kubectl get -n $your-ns-to-delete


Additional Information


This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:000021065
  • Creation Date: 06-Jul-2023
  • Modified Date:06-Jul-2023
    • SUSE Rancher

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

Join Our Community

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

SUSE Customer Support Quick Reference Guide SUSE Technical Support Handbook Update Advisories
Support FAQ

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.

Go to Customer Center