How to handle kind conflicts across apiservice

7/16/2020

I have two apiservice with a Certificate kind: cert-manager.io and certmanager.k8s.io. When I use kubectl get certificate --all-namespaces it says no resources found because it appears to be checking certmanager.k8s.io, but my certs are created under cert-manager.io.

I don't need certmanager.k8s.io so I tried deleting it but it won't delete even though it reports it was deleted.

kubectl delete apiservice v1alpha1.certmanager.k8s.io  
apiservice.apiregistration.k8s.io "v1alpha1.certmanager.k8s.io" deleted

Is there a way to prefer a different apiservice for a specific resource or get the one I don't need deleted?

-- Michael St Clair
kubernetes

1 Answer

7/16/2020

You might have a CRD somewhere. You can find out 🔎🔎.

$ kubectl get crd --all-namespaces

Then if you do, delete it 🔥🔥:

$ kubectl delete crd <crd-name>

Sometimes the CRDs have finalizers that will prevent them from being deleted. In which case.

$ kubectl edit crd <crd-name>

Remove the finalizer section in the YAML file:

finalizers: 👈🔥
  - xxxxxx 👈🔥

Check that the CRD is not there anymore:

$ kubectl get crd --all-namespaces

🎉🎉

-- Rico
Source: StackOverflow