everspader
everspader

Reputation: 1710

Argo CD pods and namespace stuck on terminating when uninstalling Helm chart with Terraform

I'm installing Argo CD using its helm chart through Terraform definition like below. The setup is simple, I create a namespace separate so it can be deleted on terraform destroy then I install the chart.

resource "kubernetes_namespace" "ns_argocd" {
  metadata {
    annotations = {
      name = "argocd"
    }

    name = "argocd"
  }
}

resource "helm_release" "argocd" {
  name             = "argocd"
  repository       = "https://argoproj.github.io/argo-helm"
  chart            = "argo-cd"
  namespace        = kubernetes_namespace.ns_argocd.metadata.0.name
  create_namespace = false

  version    = "5.13.1"

  depends_on = [kubernetes_namespace.ns_argocd]
}

Since I am still experimenting on the setup, I have to destroy and recreate a few times and every time that I hit terraform destroy it times out because the pods and the namespace are stuck on terminating status (see below). My current fix is to manually force delete every pod and namespace via kubectl delete [pod] -n argocd --force.

Is there anything that I'm missing to pass to the values file that will prevent this behavior?

NAME              STATUS        AGE
argocd            Terminating   3h58m
default           Active        4h4m
kube-node-lease   Active        4h4m
kube-public       Active        4h4m
kube-system       Active        4h4m
NAME                                                READY   STATUS        RESTARTS   AGE
argocd-application-controller-0                     1/1     Terminating   0          3h55m
argocd-applicationset-controller-7bb6d6d68c-p52j7   1/1     Terminating   0          3h55m
argocd-dex-server-6bc5f5689c-ps6wk                  1/1     Terminating   0          3h55m
argocd-notifications-controller-57bd8dbc87-msdnw    1/1     Terminating   0          3h55m
argocd-redis-77df65946d-fhb46                       1/1     Terminating   0          3h55m
argocd-repo-server-6984b7475d-b2625                 1/1     Terminating   0          3h55m
argocd-server-548dffcdcc-nbrhc                      1/1     Terminating   0          3h55m

Upvotes: 0

Views: 2327

Answers (2)

ak9
ak9

Reputation: 1

Here is the command that works when you have issue with argocd namespace terminating issue: kubectl patch crd/applications.argoproj.io-p'{"metadata":{"finalizers":[]}}'--type=merge

Upvotes: 0

Sabdeth
Sabdeth

Reputation: 53

Check out this link. It highlights the issue with orphaned CRDs left by Terraform. We also need to set the finalizers to [].

https://github.com/aws-ia/terraform-aws-eks-blueprints/issues/865

Upvotes: 2

Related Questions