0

I have installed consul helm repository to default namespace. Now, want to change it to a custom namespace.

So, deleted the help chart using helm uninstall command. Now, when I try to install again, getting error as CRDs are already configured earlier, need to cleanup them.

So, ran the below command to check the CRDs.

kubectl get CustomResourceDefinition --all-namespaces
NAME                                     CREATED AT
healthstates.azmon.container.insights    2021-09-24T14:19:01Z
ingressgateways.consul.hashicorp.com     2021-09-26T13:17:13Z
servicedefaults.consul.hashicorp.com     2021-09-26T13:17:13Z
serviceintentions.consul.hashicorp.com   2021-09-26T13:17:13Z
servicerouters.consul.hashicorp.com      2021-09-26T13:17:13Z

The above CRDs, I need to cleanup all with consul as subtext.

So, I tried deleting one by one.But it got stuck there without deleting them when I ran any command below.

kubectl delete crd serviceintentions.consul.hashicorp.com
customresourcedefinition.apiextensions.k8s.io "serviceintentions.consul.hashicorp.com" deleted

I waited for 1 hour, but no response so entered ctrl+c to cancel and ran get command again, seems they are not deleted.

Please suggest how to fix this?

uday kiran
  • 46
  • 4
  • How exactly did you install `consul` using `helm`? Which exact command did you use? When I installed `consul` from `hashicorp` via helm chart, there's no `crd`s at all. – moonkotte Oct 28 '21 at 08:08

1 Answers1

0

Reference link

Can you please perform a kubectl get crd -A -o yaml | grep -i finalizers to check if the delete operation is in deadlock with finalizers set on the CRDs?

In that case, you can perform the following:

 kubectl patch crd <custome-resource-definition-name> -n <namespace> -p '{"metadata":{"finalizers":[]}}' --type=merge
 kubectl delete crd <custome-resource-definition-name> -n <namespace>

Above is the response I got in the MSDN forum. But that didn't work for me. So, I manually edited the CRD by using below command and deleted the finalizer section fromt he CRDs, then it got deleted directly.

kubectl edit crd <CRD-Name>

Thank you very much for your reply.

sysadmin1138
  • 131,083
  • 18
  • 173
  • 296
uday kiran
  • 46
  • 4