Skip to main content

Introduction

The ApplicationSet controller is a Kubernetes controller that adds support for an ApplicationSet CustomResourceDefinition (CRD). This controller enables both automation and greater flexibility when managing Argo CD Applications across a large number of clusters and within monorepos, plus it makes self-service usage possible on multitenant Kubernetes clusters.
Starting with Argo CD v2.3, the ApplicationSet controller is bundled with Argo CD.
The ApplicationSet controller works alongside an existing Argo CD installation to provide:
  • The ability to use a single Kubernetes manifest to target multiple Kubernetes clusters with Argo CD
  • The ability to use a single Kubernetes manifest to deploy multiple applications from one or multiple Git repositories
  • Improved support for monorepos: multiple Argo CD Application resources defined within a single Git repository
  • Within multitenant clusters, improved ability of individual cluster tenants to deploy applications using Argo CD (without needing privileged cluster administrator involvement)
Be aware of the security implications of ApplicationSets before using them.

The ApplicationSet Resource

Here’s an example ApplicationSet that deploys a guestbook application to multiple clusters:
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: guestbook
spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
  - list:
      elements:
      - cluster: engineering-dev
        url: https://1.2.3.4
      - cluster: engineering-prod
        url: https://2.4.6.8
      - cluster: finance-preprod
        url: https://9.8.7.6
  template:
    metadata:
      name: '{{.cluster}}-guestbook'
    spec:
      project: my-project
      source:
        repoURL: https://github.com/infra-team/cluster-deployments.git
        targetRevision: HEAD
        path: guestbook/{{.cluster}}
      destination:
        server: '{{.url}}'
        namespace: guestbook

How It Works

1

Generate Parameters

The ApplicationSet controller processes the generator entries, producing a set of template parameters.
2

Substitute into Template

These parameters are substituted into the template, once for each set of parameters.
3

Create Applications

Each rendered template is converted into an Argo CD Application resource, which is then created (or updated) within the Argo CD namespace.
4

Deploy with Argo CD

The Argo CD controller is notified of these Application resources and handles the deployment.

Generated Applications

With the three clusters defined in the example above, the ApplicationSet controller will generate three Argo CD Applications:
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  name: engineering-dev-guestbook
spec:
  source:
    repoURL: https://github.com/infra-team/cluster-deployments.git
    targetRevision: HEAD
    path: guestbook/engineering-dev
  destination:
    server: https://1.2.3.4
    namespace: guestbook

Automatic Updates

The ApplicationSet controller ensures that any changes, updates, or deletions made to ApplicationSet resources are automatically applied to the corresponding Applications.
If a new cluster/URL entry is added to the List generator, a new Argo CD Application resource will be automatically created for this cluster.

Parameter Substitution

Generators produce parameters, which are key-value pairs that are substituted into the template: section during rendering. In the example above:
  • The List generator defines cluster and url parameters
  • These are substituted into {{.cluster}} and {{.url}} template values
  • Each set of parameters produces one Application

Available Generators

Multiple generator types are supported by the ApplicationSet controller:

List Generator

Fixed list of cluster name/URL values

Cluster Generator

Automatically uses clusters defined in Argo CD

Git Generator

Parameters from files or directories in Git

Matrix Generator

Combines parameters from two generators

Merge Generator

Merges parameters from multiple generators

SCM Provider

Discovers repositories in GitHub/GitLab organizations

Pull Request

Discovers open pull requests

Cluster Decision Resource

Uses custom resources for cluster selection

Next Steps

Generators

Learn about different generator types and their configuration

Use Cases

Explore common patterns like multi-cluster deployments and monorepos

Security

Understand security considerations for ApplicationSets

Build docs developers (and LLMs) love