Mastering Cluster Bootstrapping with Argo CD
Cluster bootstrapping is essential for managing applications across multiple Kubernetes clusters efficiently. It solves the problem of manual deployment and configuration, allowing you to automate the process and ensure consistency. With Argo CD, you can use ApplicationSets to deploy applications based on cluster labels, making it easier to manage complex environments.
To bootstrap a cluster, follow the Declaratively setup guide. You can create a cluster, assign it labels, and add it to Argo CD. Any ApplicationSet that uses these labels will deploy the respective applications. The sync policy is set to automated with pruning enabled by default, which means that child apps are automatically created, synced, and deleted when the parent app's manifest changes. This is particularly useful when using the App of Apps pattern, which allows you to declaratively specify one Argo CD app that consists only of other apps. You also have access to all gotemplate functions and Sprig methods, eliminating the need for Helm templating.
In production, be aware that the App of Apps pattern is an admin-only tool, which may limit its use in certain scenarios. Additionally, consider modifying the bootstrapping behavior to deploy applications in waves, especially if you have a large number of apps. Starting from version 3.2, Argo CD ensures consistent deletion behavior, whether you delete from the Applications List or the parent application's Resource Tree. This can help prevent orphaned resources and streamline management.
Key takeaways
- →Utilize ApplicationSets to handle typical deployment scenarios in your cluster.
- →Set the sync policy to automated with pruning enabled for efficient app management.
- →Leverage the App of Apps pattern to manage multiple applications declaratively.
Why it matters
In production, automating cluster bootstrapping can significantly reduce deployment time and minimize human error. This leads to more reliable application delivery and better resource management across your Kubernetes environments.
Code examples
1apiVersion:argoproj.io/v1alpha1
2kind:ApplicationSet
3metadata:
4 name: eu-only-appset
5 namespace: argocd
6spec:
7 goTemplate: true
8 goTemplateOptions: ["missingkey=error"]
9 generators:
10 - matrix:
11 generators:
12 - git:
13 repoURL: <a git repo>
14 revision: HEAD
15 directories:
16 - path: my-eu-apps/*
17 - clusters:
18 selector:
19 matchLabels:
20 type: "workload"
21 region: "eu"
22 template:
23 metadata:
24 name: 'eu-only-{{index.path.segments1}}-{{.name}}'
25 spec:
26 project: default
27 source:
28 repoURL: <a git repo>
29 targetRevision: HEAD
30 path: '{{.path.path}}'
31 destination:
32 server: '{{.server}}'
33 namespace: 'eu-only-{{index.path.segments1}}'
34 syncPolicy:
35 syncOptions:
36 - CreateNamespace=true
37 automated:
38 prune: true
39 selfHeal: true1apiVersion:argoproj.io/v1alpha1
2kind:Application
3metadata:
4 name: guestbook
5 namespace: argocd
6finalizers:
7 - resources-finalizer.argocd.argoproj.io
8spec:
9 destination:
10 namespace: argocd
11 server: {{.Values.spec.destination.server}}
12 project: default
13 source:
14 path: guestbook
15 repoURL: https://github.com/argoproj/argocd-example-apps
16 targetRevision: HEAD
17 syncPolicy:
18 automated:
19 prune: true1argocd app create apps \
2 --dest-namespace argocd \
3 --dest-server https://kubernetes.default.svc \
4 --repo https://github.com/argoproj/argocd-example-apps.git \
5 --path apps \
6 argocd app sync appsWhen NOT to use this
The official docs don't call out specific anti-patterns here. Use your judgment based on your scale and requirements.
Want the complete reference?
Read official docsDeploy any app in seconds — no infrastructure config, no DevOps overhead. Instant deployments from GitHub, built-in databases, and automatic scaling.
Start deploying free →Navigating Bug Bounty Features: A Researcher's Strategy
Choosing which features to investigate in a bug bounty program can make or break your success. Learn how researchers can earn VIP status by consistently delivering high-quality findings, including specific metrics for critical and high-severity vulnerabilities.
Building Git Infrastructure for Agent-Scale Development
In a world where repositories receive millions of commits daily, traditional Git setups can falter. This article dives into how a robust architecture using Spokes and a three-phase commit protocol ensures consistency across CI, web UI, and API clients.
Uncovering 24 Android Vulnerabilities with Our Open Source AI Security Agent
Discover how we leveraged an open source AI security agent to identify 24 vulnerabilities in Android applications. By utilizing taskflows, we guided the AI through complex security assessments, focusing on critical components like intents and exported activities.
Get the daily digest
One email. 5 articles. Every morning.
No spam. Unsubscribe anytime.