question

UdayKiranReddyureddy-2664 avatar image
0 Votes"
UdayKiranReddyureddy-2664 asked srbose-msft edited

Custom CRDs not getting deleted in aks cluster, how to delete that?

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?

azure-kubernetes-service
· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Can you please perform a kubectl get crd -A -o jsonpath='{.items[*].metadata.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>
1 Vote 1 ·
Show more comments

1 Answer

UdayKiranReddyureddy-2664 avatar image
1 Vote"
UdayKiranReddyureddy-2664 answered srbose-msft edited

Applying the patch command didn't work.
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.
Also, can you suggest, how to rename a cluster in azure kubernetes, either through portal or any API Command, whichever is possible



· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@UdayKiranReddyureddy-2664 , thank you for posting your answer. This will definitely help others in the community looking for answers on similar topics.

At the time of writing, you cannot change the name of an AKS cluster after creation. For an AKS cluster with a new name you have to redeploy the AKS cluster. [Reference]

0 Votes 0 ·