Skip to content

Argo CD

First PublishedByAtif Alam

Argo CD is a CNCF graduated GitOps controller for Kubernetes. It runs in the cluster and continuously syncs applications from Git to match desired state.

This page covers the Argo CD tool. For GitOps practice (push vs pull, repo layouts, promotion) and Flux, see GitOps. For how Argo CD relates to Helm and operators, see Helm vs operators vs GitOps.

Git Repository (desired state)
│
│ Argo CD watches for changes
▼
Argo CD Controller (in cluster)
│
│ Compares desired state (Git) vs live state (cluster)
│
├── In Sync ──► nothing to do
│
└── Out of Sync ──► reconcile (apply changes to cluster)
ConceptWhat It Is
ApplicationA CRD that maps a Git repo path to a Kubernetes namespace
ProjectGroups applications with shared access policies and allowed destinations
SyncApply the desired state from Git to the cluster
HealthWhether the deployed resources are running correctly
RefreshCheck Git for changes (automatic or manual)
Terminal window
# Install Argo CD in the cluster
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
# Install the CLI
brew install argocd
# Get the initial admin password
argocd admin initial-password -n argocd
# Login
argocd login localhost:8080
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: myapp
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/example/k8s-config.git
targetRevision: main
path: apps/myapp/overlays/production # Path in the repo
destination:
server: https://kubernetes.default.svc
namespace: myapp
syncPolicy:
automated:
prune: true # Delete resources removed from Git
selfHeal: true # Auto-correct manual changes (drift)
syncOptions:
- CreateNamespace=true
retry:
limit: 3
backoff:
duration: 5s
factor: 2
maxDuration: 3m
PolicyWhat It Does
Manual syncUser clicks Sync in the UI or CLI
Auto syncArgo CD syncs whenever Git changes
Self-healAuto-correct drift (someone ran kubectl edit on a resource)
PruneDelete resources that were removed from Git
Terminal window
# List applications
argocd app list
# Sync an application (deploy)
argocd app sync myapp
# Get application status
argocd app get myapp
# View diff (what would change)
argocd app diff myapp
# Rollback to a previous Git revision
argocd app rollback myapp --revision 3
# Hard refresh (re-read from Git)
argocd app get myapp --hard-refresh

Both patterns solve the same problem: managing many Argo Applications without creating each one by hand.

PatternHow it worksBest forDownside
App of AppsOne parent Application points at a Git directory of child Application manifestsCluster bootstrapping (cert-manager, ingress, monitoring), curated platform setsRepetitive at scale (services × clusters = many near-identical files)
ApplicationSetOne template + a generator produces Applications automaticallyMulti-cluster, multi-env, per-tenant, per-PR preview envsMore abstraction; deletes can cascade if misconfigured
Common combo: a root App of Apps that deploys the ApplicationSets.

Every child is a real, reviewable YAML file. Order installs with sync waves (lower waves sync first).

platform-gitops/
└── bootstrap/
├── root.yaml # Parent Application (points at this directory)
├── cert-manager.yaml # Child Application
└── ingress-nginx.yaml
# bootstrap/root.yaml — parent Application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: root
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/example/platform-gitops
targetRevision: main
path: bootstrap
destination:
server: https://kubernetes.default.svc
namespace: argocd
syncPolicy:
automated:
prune: true
selfHeal: true
# bootstrap/cert-manager.yaml — child with sync wave
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: cert-manager
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-1"
spec:
project: default
source:
repoURL: https://charts.jetstack.io
chart: cert-manager
targetRevision: v1.15.3
helm:
values: |
crds:
enabled: true
destination:
server: https://kubernetes.default.svc
namespace: cert-manager
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true

Pin chart versions. Use sync waves so CRDs and platform add-ons land before workloads that depend on them. See Sync Waves.

An ApplicationSet is a CRD plus controller: one template + a generator produces many Applications.

GeneratorWhat it produces
ListFixed params (envs, regions)
ClusterOne app per registered cluster, filtered by labels (ideal for fleets)
GitOne app per directory or config file
SCM Provider / Pull RequestPer repo or per open PR (preview environments)
Matrix / MergeCombine generators (for example service × cluster)

Use preserveResourcesOnDeletion and applicationsSync: create-update so deleting an ApplicationSet does not cascade-delete live workloads by surprise.

List generator (fixed envs):

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: cluster-apps
namespace: argocd
spec:
generators:
- list:
elements:
- cluster: staging
url: https://staging-k8s.example.com
- cluster: production
url: https://prod-k8s.example.com
template:
metadata:
name: 'myapp-{{cluster}}'
spec:
project: default
source:
repoURL: https://github.com/example/platform-gitops
path: 'apps/myapp/overlays/{{cluster}}'
destination:
server: '{{url}}'
namespace: myapp

Matrix generator (every service × every prod cluster):

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: services-prod
namespace: argocd
spec:
goTemplate: true
goTemplateOptions: ["missingkey=error"]
generators:
- matrix:
generators:
- clusters:
selector:
matchLabels:
env: prod
- git:
repoURL: https://github.com/example/platform-gitops
revision: main
directories:
- path: services/*
template:
metadata:
name: '{{.path.basename}}-{{.name}}'
spec:
project: default
source:
repoURL: https://github.com/example/platform-gitops
targetRevision: main
path: '{{.path.path}}/overlays/{{index .metadata.labels "env"}}'
destination:
server: '{{.server}}'
namespace: '{{.path.basename}}'
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
syncPolicy:
preserveResourcesOnDeletion: true
applicationsSync: create-update

missingkey=error makes template typos fail loudly. Consider ApplicationSet progressive syncs to roll out region by region on large fleets.

Argo CD syncs resources (and Applications in an App of Apps) in wave order. Annotate with argocd.argoproj.io/sync-wave (string integer; default 0). Lower waves finish before higher ones start.

Typical bootstrap order: CRDs / cert-manager (-1 or 0) → ingress / monitoring (0–1) → application workloads (higher). Pair with health checks so the next wave waits until the previous is Ready.

Never let automation prune CRDs by surprise — use argocd.argoproj.io/sync-options: Prune=false on CRDs. See Cluster upgrades — CRD upgrades.

Argo CD manages remote clusters via a Secret in the argocd namespace (argocd.argoproj.io/secret-type: cluster). Label clusters so ApplicationSet cluster generators can select them.

Generic shape (bearer token or other auth in config):

apiVersion: v1
kind: Secret
metadata:
name: prod-usw2
namespace: argocd
labels:
argocd.argoproj.io/secret-type: cluster
env: prod
region: us-west-2
stringData:
name: prod-usw2
server: https://kubernetes.example.com:6443
config: |
{
"bearerToken": "TOKEN",
"tlsClientConfig": { "caData": "BASE64_CA" }
}

EKS variant — use IAM auth instead of a long-lived bearer token:

apiVersion: v1
kind: Secret
metadata:
name: eks-prod-usw2
namespace: argocd
labels:
argocd.argoproj.io/secret-type: cluster
env: prod
region: us-west-2
stringData:
name: eks-prod-usw2
server: https://EXAMPLE.gr7.us-west-2.eks.amazonaws.com
config: |
{
"awsAuthConfig": {
"clusterName": "prod-usw2",
"roleARN": "arn:aws:iam::111111111111:role/argocd-deployer"
},
"tlsClientConfig": { "caData": "BASE64_CA" }
}

Give the Argo controller an IAM role via IRSA or EKS Pod Identity. Map that role in each target cluster with EKS access entries (or the older aws-auth ConfigMap). See EKS overview for cluster context.

Argo CD itself is not EKS-specific — this subsection is only the AWS wiring.