TL;DR

ApplicationSets generate many ArgoCD Applications from a template + generator. Use them for multi-cluster deploys, monorepo app discovery, or Git directory scanning — instead of hand-writing one Application per app.

When to Use

ScenarioGenerator
Deploy same app to many clustersclusters
One Application per folder in Gitgit (directories)
One Application per registered clusterclusterDecisionResource or clusters
Matrix of clusters × environmentsmatrix (combine generators)
Explicit list of appslist

Git Directory Generator

Scans a Git repo path and creates one Application per subdirectory — common for monorepos.

yaml applicationset-git.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: platform-apps
  namespace: argocd
spec:
  generators:
    - git:
        repoURL: https://github.com/example/platform-apps.git
        revision: main
        directories:
          - path: apps/*
  template:
    metadata:
      name: "{{path.basename}}"
    spec:
      project: platform
      source:
        repoURL: https://github.com/example/platform-apps.git
        targetRevision: main
        path: "{{path}}"
      destination:
        server: https://kubernetes.default.svc
        namespace: "{{path.basename}}"
      syncPolicy:
        automated:
          prune: true
          selfHeal: true
        syncOptions:
          - CreateNamespace=true

Cluster Generator

Deploys the same source to every cluster registered in ArgoCD.

yaml applicationset-clusters.yaml
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: ingress-all-clusters
  namespace: argocd
spec:
  generators:
    - clusters:
        selector:
          matchLabels:
            env: production
  template:
    metadata:
      name: "ingress-{{name}}"
    spec:
      project: platform
      source:
        repoURL: https://github.com/example/platform-addons.git
        targetRevision: main
        path: ingress-nginx
        helm:
          valueFiles:
            - values-{{metadata.labels.env}}.yaml
      destination:
        server: "{{server}}"
        namespace: ingress-nginx
      syncPolicy:
        syncOptions:
          - CreateNamespace=true

Matrix Generator

The matrix generator combines two generator outputs, such as clusters and environments, to create many Applications from one template. Use it when the same app or add-on must be deployed across multiple clusters with environment-specific values.

yaml applicationset-matrix.yaml
spec:
  generators:
    - matrix:
        generators:
          - clusters:
              selector:
                matchLabels:
                  env: production
          - git:
              repoURL: https://github.com/example/platform-apps.git
              revision: main
              directories:
                - path: apps/*
  template:
    metadata:
      name: "{{path.basename}}-{{name}}"
    spec:
      source:
        repoURL: https://github.com/example/platform-apps.git
        path: "{{path}}"
      destination:
        server: "{{server}}"
        namespace: "{{path.basename}}"

Commands

Use these commands to inspect generated child Applications and confirm whether the ApplicationSet controller is creating, updating, or failing to reconcile them.

bash applicationset.sh
kubectl get applicationsets -n argocd
kubectl describe applicationset platform-apps -n argocd
kubectl get applications -n argocd -l argocd.argoproj.io/application-set-name=platform-apps

# List registered clusters.
argocd cluster list

Gotchas

  • !Template typos scale badly — a bad template creates broken Applications across all clusters.
  • !Prune on generated apps — removing a directory from Git deletes the Application and its resources.
  • !Go templates in metadata.name — must produce valid K8s names; use path.basename not full paths.
  • !Cluster secrets — clusters generator only works for clusters registered in ArgoCD.