Problems with removing namspace. Error in apiserver

Hello,

I recently deployed Rancher 2.0.3 and created 3 node k8s cluster (10.1 k8s, 17.03 docker ce). I started playing with Longhorn but after some fun i tried to remove it. All pods were deleted, catalog app also but namespace still persists. Api-Server give me logs:

E0702 20:01:07.365387 1 crd_finalizer.go:131] Operation cannot be fulfilled on customresourcedefinitions.apiextensions.k8s.ioreplicas.longhorn.rancher.io”: the object has been modified; please apply your changes to the latest version and try again

I tried to remove resource “manually” and play with local kubectl (found on stackoverflow trying removal of “finalizers” in namespace definitions - but editing namespace didn’y “apply”).

Currently we are on dev machine so it’s not “a big deal” but does anybody have an idea how to remove these “zombie namespace”? I tried --force, --grace-period but api response was always “the resource is currently removing etc…”. On kubernetes cluster state of namespace is “Terminating” (for few hours now).

1 Like

Try removing the finalizer by patching:

kubectl patch ns FOONS --type merge -p '{"metadata":{"finalizers": null}}'

1 Like

Doesnt work … It says -
namespace “zombie1” not patched

It’s almost always the existence of CRD’s that prevents the Longhorn directory from deleting properly. List your Custom Resource Definitions, and delete the ones that have longhorn in their name. The namespace will then delete.

Then use nfs-client-provisioner instead of longhorn…