ApplicationSet
Introduction
ApplicationSet controller is a Kubernetes controller that adds support for an ApplicationSet CustomResourceDefinition (CRD). This controller/CRD enables both automation and greater flexibility managing Argo CD Applications across a large number of clusters and within monorepos, plus it makes self-service usage possible on multitenant Kubernetes clusters.
Use Cases for ApplicationSet
- Deploying multiple similar applications: When you need to deploy multiple applications with similar configurations, you can use ApplicationSet to reduce redundant configurations. For example, you could use ApplicationSet to deploy multiple microservices that utilize the same template, but have different service names and port numbers.
- Multi - cluster deployments: When you need to deploy the same application across multiple Kubernetes clusters, you can use ApplicationSet to simplify configuration. For instance, you could define an application with ApplicationSet and deploy it across multiple clusters, each using different parameters.
- Dynamically generating applications: When you need to dynamically generate applications based on certain conditions, ApplicationSet can be utilized. For example, you could dynamically generate different application instances based on branches or tags in a Git repository.
ApplicationSet Example
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
References