Why is the namespace where my storage operator was deployed stuck in Terminating status?
When you remove a storage configuration from a cluster, the resources such as operator pods and storage classes are removed, but the namespace is stuck in Terminating status.
Finalizers are preventing the remaining resources in the namespace and the namespace itself from being deleted.
Take the following steps to remove the resources and the namespace.
Do not delete or patch the resource finalizers in the kube-system namespace.
- Get the namespace that is stuck in
Terminatingstatus. Make a note of the resources that are listed in themessage: 'Some resources are remaining:section.
Example output for a NetApp Trident namespaceoc get ns <namespace> -o yamlstatus: conditions: - lastTransitionTime: "2021-05-18T17:40:31Z" message: All resources successfully discovered reason: ResourcesDiscovered status: "False" type: NamespaceDeletionDiscoveryFailure - lastTransitionTime: "2021-05-18T17:40:31Z" message: All legacy kube types successfully parsed reason: ParsedGroupVersions status: "False" type: NamespaceDeletionGroupVersionParsingFailure - lastTransitionTime: "2021-05-18T17:40:31Z" message: All content successfully deleted, may be waiting on finalization reason: ContentDeleted status: "False" type: NamespaceDeletionContentFailure - lastTransitionTime: "2021-05-18T17:40:31Z" message: 'Some resources are remaining: tridentbackends.trident.netapp.io has 1 resource instances, tridentnodes.trident.netapp.io has 3 resource instances, tridentversions.trident.netapp.io has 1 resource instances, tridentvolumes.trident.netapp.io has 1 resource instances' reason: SomeResourcesRemain status: "True" type: NamespaceContentRemaining - lastTransitionTime: "2021-05-18T17:40:31Z" message: 'Some content in the namespace has finalizers remaining: trident.netapp.io in 6 resource instances' reason: SomeFinalizersRemain status: "True" type: NamespaceFinalizersRemaining phase: Terminating - Run the
oc getcommand to get the resources that are pending removal. In the example output, thetridentbackends.trident.netapp.ioresource lists 1 resource instance. Repeat this step for each resource that lists instances in themessagesection of the namespace YAML that you retrieved earlier.
Example command for theoc get <resource> -n <namespace>tridentbackends.trident.netapp.ioresource.
Example outputoc get tridentbackends.trident.netapp.io -n tridenttbe-bhb5rpvc-26d97ecd-c268-47ff-a2fd-a0a1a51a9e12 - For each resource that lists instances, run the following
kubectl patchcommand to remove the finalizers and delete the resource. After all the resources are patched, the namespace is removed.Example command for thekubectl -n <namespace> patch <resource>/<instance> -p '{"metadata":{"finalizers":[]}}' --type=mergetridentbackends.trident.netapp.ioresource.kubectl -n trident patch tridentbackends.trident.netapp.io/tbe-bhb5r -p '{"metadata":{"finalizers":[]}}' --type=merge - After you remove the finalizers on the remaining resources, run the
oc get nscommand to verify that the namespace is removed.oc get ns