All Products
Search
Document Center

Container Service for Kubernetes:Use an ApplicationSet to create multiple applications

Last Updated:Mar 26, 2026

Managing deployments across multiple clusters by creating each Argo CD Application individually becomes error-prone as the number of clusters grows. An ApplicationSet solves this by letting you define one generator and one template — the ApplicationSet controller renders an Application for each cluster automatically, keeping all clusters in sync from a single source of truth.

Use this approach when:

  • Multi-environment deployments: Roll out the same application to production and staging clusters with environment-specific configurations.

  • Cluster add-ons: Install a consistent set of tools (monitoring, logging, ingress) across a fleet of clusters.

  • Self-service deployments: Let teams deploy to clusters they own without modifying shared configuration.

How it works

The ApplicationSet controller processes your manifest in four steps:

  1. The generator produces a set of key-value parameters. In the List generator, each element in the list becomes one parameter set.

  2. The parameters are substituted into the template, once per parameter set.

  3. Each rendered template becomes an Argo CD Application resource, which is created or updated.

  4. The Argo CD controller picks up the new Application resources and manages their sync lifecycle.

Prerequisites

Before you begin, make sure you have:

  • Logged in to the GitOps system. For details, see Log on to the GitOps system.

  • kubectl installed and the kubeconfig file for the ACK One Fleet instance you want to use. The default kubeconfig path is ~/.kube/config.

Deploy an ApplicationSet

This example deploys the echo-server application to two clusters: Cluster Production and Cluster Staging. The two clusters run different versions of echo-server and expose the application differently, so each cluster has its own subdirectory in the Git repository.

Git repository structure used in this example:

.
├── Dockerfile
├── go.mod
├── go.sum
├── main.go
└── manifests
    └── directory
        ├── production
        │   ├── deployment.yaml
        │   └── service.yaml
        └── staging
            ├── deployment.yaml
            └── service.yaml

Step 1: Create the ApplicationSet manifest

Create a file named applicationset.yaml with the following content.

The List generator defines two parameter sets — one per cluster. The {{cluster}} and {{url}} variables are substituted into the template to produce two Applications: production-echo-server and staging-echo-server. Each Application points to the manifest subdirectory for its environment.

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: echo-server
spec:
  generators:
  - list:
      elements:
      - cluster: production
        url: https://47.91.XX.XX:6443
      - cluster: staging
        url: https://47.111.XX.XX:6443
      # To add more clusters, append another element here:
      # - cluster: <cluster-name>
      #   url: <cluster-api-server-url>
  template:
    metadata:
      name: '{{cluster}}-echo-server'
    spec:
      project: default
      source:
        repoURL: https://code.aliyun.com/shuwei.hsw/echo-server.git
        targetRevision: main
        path: manifests/directory/{{cluster}}
      destination:
        server: '{{url}}'
        namespace: multi-echo-server

Step 2: Deploy the ApplicationSet

kubectl -n argocd apply -f applicationset.yaml

Step 3: Verify the Applications were created

kubectl -n argocd get application

Expected output:

NAME                     SYNC STATUS   HEALTH STATUS
production-echo-server   OutOfSync     Missing
staging-echo-server      OutOfSync     Missing

OutOfSync means the Applications exist but have not yet been deployed to the clusters.

Step 4: Sync the applications to the clusters

argocd app sync production-echo-server staging-echo-server

Step 5: Verify access

Test access to each environment after the sync completes.

Cluster Production (echo-server v1.0):

curl XX.XX.XX.XX:8080/version

Expected output:

"Hello Echo Server v1.0"

Cluster Staging (echo-server v2.0):

curl XX.XX.XX.XX:8080/version

Expected output:

"Hello Echo Server v2.0"

Replace XX.XX.XX.XX with the external IP address of the echo-server Service in the respective cluster.

What's next

  • To learn about other generator types (Cluster, Git, Matrix, and more), see ApplicationSet generators in the Argo CD documentation. If you are new to generators, start with the List and Cluster generators.

  • For the full ApplicationSet specification, see ApplicationSet.