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.
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.
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
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
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com