Not able to completely remove Kubernetes CustomResource
$ kubectl get crd
NAME CREATED AT
accesscontrolpolicies.networking.zephyr.solo.io 2020-04-22T12:58:39Z
istiooperators.install.istio.io 2020-04-22T13:49:20Z
kubernetesclusters.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
meshes.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
meshservices.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
meshworkloads.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
trafficpolicies.networking.zephyr.solo.io 2020-04-22T12:58:39Z
virtualmeshcertificatesigningrequests.security.zephyr.solo.io 2020-04-22T12:58:39Z
virtualmeshes.networking.zephyr.solo.io 2020-04-22T12:58:39Z
$ kubectl delete crd istiooperators.install.istio.io
delete error
$ kubectl patch crd/istiooperators.install.istio.io -p '{"metadata":{"finalizers":[]}}' --type=merge
success delete crd istiooperators.install.istio.io
result
NAME CREATED AT
accesscontrolpolicies.networking.zephyr.solo.io 2020-04-22T12:58:39Z
kubernetesclusters.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
meshes.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
meshservices.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
meshworkloads.discovery.zephyr.solo.io 2020-04-22T12:58:39Z
trafficpolicies.networking.zephyr.solo.io 2020-04-22T12:58:39Z
virtualmeshcertificatesigningrequests.security.zephyr.solo.io 2020-04-22T12:58:39Z
virtualmeshes.networking.zephyr.solo.io 2020-04-22T12:58:39Z
So it turns out , the root cause was that Custom resources with finalizers can "deadlock". The CustomResource "functions.kubeless.io" had a
Finalizers:
customresourcecleanup.apiextensions.k8s.io
and this is can leave it in a bad state when deleting.
https://github.com/kubernetes/kubernetes/issues/60538
I followed the steps mentioned in this workaround and it now gets deleted. Hope this helps anyone else who runs into this.