Scalable Deployment Orchestration with ArgoCD Applicationset

Hardik Patel
DevOps.dev
Published in
3 min readJan 9, 2024

--

In ArgoCD, the ApplicationSet controller manages the creation and synchronization of multiple applications based on defined templates and parameters. It’s a powerful feature designed to facilitate the management and deployment of a large number of applications across multiple clusters in a more efficient and scalable manner

ApplicationSet responsible for interpreting ApplicationSet custom resources, processing them, and dynamically creating Application resources based on the specified parameters.

Generators in ApplicationSet

Generators are a key component within ApplicationSets that define how applications are created based on templates and parameters. They facilitate the dynamic generation of application resources using user-defined rules or configurations.

To know more about , please follow official ArgoCD Docs.

Now lets first add remote cluster in ArgoCD.

Adding Remote Cluster in ArgoCD,

First login ArgoCD cli,

argocd login url

Now lets add our remote eks cluster ,

argocd cluster add arn:aws:eks:ap-south-1:xxxx:cluster/xxxx --kubeconfig /home/hardik/.kube/config

verify using CLI that cluster is added,

argocd cluster list

As per above SS checked that server is added but its showing unknown status. This happened due to still we didnt deploy any application. Lets deploy sample application,

yaml,

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: guestbook-remote
namespace: default
spec:
destination:
namespace: argocd
server: "xxx"
project: default
source:
path: guestbook
repoURL: "https://github.com/hardikpatel29/argocd-examples.git"
targetRevision: master
syncPolicy:
syncOptions:
- CreateNamespace=true

apply,

kubectl apply -f apps.yaml

verify it in GUI

Now Lets Create applicationset that will deploy application on multiple cluster,

yaml,

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: guestbook
namespace: argocd
spec:
generators:
- list:
elements:
- cluster: local-cluster
url: https://kubernetes.default.svc
- cluster: test-eks-remote
url: xxx.ap-south-1.eks.amazonaws.com
template:
metadata:
name: '{{cluster}}-guestbook'
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/hardikpatel29/argocd-examples.git
targetRevision: master
path: guestbook
destination:
server: '{{url}}'
namespace: guestbook
syncPolicy:
syncOptions:
- CreateNamespace=true

lets apply it,

kubectl apply -f applicationset-list-generator.yaml

Here We got error like as per above snapshot. In such case verify that application set CRD is installed or not. If not than we must need to install it first.

kubectl apply -f https://raw.githubusercontent.com/argoproj-labs/applicationset/v0.1.0/manifests/install.yaml

Lets verify resources,

kubectl api-resources | grep ApplicationSet

Now we are good to go to deploy applicationset.

kubectl apply -f applicationset-list-generator.yaml

Verify GUI.

Conclusion:

The orchestration capabilities provided by ApplicationSets empower DevOps teams to streamline deployment workflows, reduce operational overhead, and ensure consistency in application configurations. The role of generators, facilitates dynamic application creation, enabling scalability and flexibility in managing diverse sets of applications.

That’s it, thank you all…! don’t forget to leave a 👏✌️❤️

--

--