argocdgitops

ArgoCD deploy app-of-apps to remote cluster


I'm trying to deploy the following app-of-apps core-services to my development cluster. I only have one ArgoCD instance in a control cluster where I want to deploy this app-of-apps pattern to my remote clusters. The app-of-apps pattern looks like this:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: core-services-development
#  namespace: argocd
spec:
  project: default
  destination:
    name: japasp-development-cluster
#    namespace: argocd
  source:
    repoURL: git@gitlab.com:REDACTED/gitops/argocd.git
    path: environments/development/apps/core-services
    targetRevision: main
  syncPolicy:
    automated:
      allowEmpty: true
      prune: true
      selfHeal: false

My core service app pattern, for example external-dns, looks like this:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: external-dns
#  namespace: argocd
  finalizers:
  - resources-finalizer.argocd.argoproj.io
spec:
  project: default
  destination:
    name: japasp-development-cluster
    namespace: external-dns
  source:
    repoURL: https://charts.bitnami.com/bitnami
    chart: external-dns
    targetRevision: 6.31.6
    plugin:
      name: argocd-vault-plugin-helm
      env:
        - name: HELM_VALUES
          value: |
            replicaCount: 3
            resources:
              requests:
                cpu: 10m
                memory: 50Mi
              limits:
                cpu: 10m
                memory: 50Mi
            sources: ['ingress']
            provider: cloudflare
            cloudflare:
              apiToken: <path:kv2/data/cloudflare/api/external-dns#all-domains>
              proxied: false          
  syncPolicy:
    automated:
      prune: true
      selfHeal: false
      allowEmpty: false
    syncOptions:
      - CreateNamespace=true

When I try to sync it I get the following error:

The Kubernetes API could not find argoproj.io/Application
for requested resource /cert-manager. Make sure the
"Application" CRD is installed on the destination cluster.

Whats wrong here?

I tried to play around with the namespaces but I messed up my control-cluster where these core services are deployed too.


Solution

  • The Application CR is only defined in your "control" cluster but you're trying to deploy an Application in your "development" cluster, hence the error.

    In an apps-of-apps pattern, you want to deploy the apps definition in the "control" cluster. Only the "final" resources must be deployed in your "development" (or other) cluster.

    If core-services GitOps directory contains only Application definitions, then you want the destination of core-services-development to be the "control" cluster.