generators:
- matrix:
generators:
- clusters: {}
- git:
directories: [{ path: apps/* }]
ArgoCD
Topics in this category
ArgoCD
Applications
Generators include: List (static values), Cluster (per registered cluster), Git (per directory or from a config file in Git), Matrix (combine two generators), Merge (overlay generators), SCM Provider (per repo in an org), and Pull Request (per open PR, great for preview environments). You pick based on whether apps vary by cluster, directory, repo, or PR.
Real-world example
A matrix generator crosses every cluster with every app directory to deploy all apps to all clusters from one ApplicationSet.
Multi-cluster
App of Apps
Applications
Use the ApplicationSet Pull Request generator: it creates an Application for each open PR (parameterized by branch/PR number), deploying a preview environment, and deletes it when the PR closes. This gives reviewers a live environment per PR without manual setup, cleaned up automatically.
generators:
- pullRequest:
github:
owner: org
repo: web
requeueAfterSeconds: 60
Real-world example
Every pull request spins up its own namespace/preview URL via the PR generator, torn down on merge or close.
Multi-cluster
App of Apps
Applications
ignoreDifferences tells ArgoCD to disregard specified fields when computing diffs, so the app doesn't show OutOfSync due to values mutated by controllers (e.g., replica counts set by HPA, or webhook-injected fields). You target fields by group/kind and JSON pointers or jq/JSONPath, preventing false drift and sync fights.
spec:
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas # managed by HPA
Real-world example
With HPA controlling replicas, ArgoCD ignores /spec/replicas so it doesn't constantly report drift or reset the count.
Sync & Health
GitOps Principles
Applications
ArgoCD labels/annotates managed resources with a tracking id (by default the label app.kubernetes.io/instance, or an annotation for the newer tracking method). This lets it know which live resources an Application owns, compute diffs, and prune orphans. The tracking method is configurable to avoid clashes with other tools using the same label.
# argocd-cm
data:
application.resourceTrackingMethod: annotation
Real-world example
Switching to annotation-based tracking prevents conflicts with Helm/Kustomize that also set the instance label.
Sync & Health
Sync Waves & Hooks
Applications
An AppProject groups Applications and enforces guardrails: which source repos are allowed, which destination clusters/namespaces apps can deploy to, and which resource kinds are permitted (allow/deny lists). Projects provide multi-tenancy boundaries and are the basis for scoping RBAC, limiting blast radius per team.
kind: AppProject
spec:
sourceRepos: ['https://github.com/org/*']
destinations:
- server: https://kubernetes.default.svc
namespace: 'team-a-*'
Real-world example
Team A's project restricts them to their repos and team-a-* namespaces, so they can't deploy elsewhere.
RBAC
Multi-cluster
Applications
Common approaches: a Kustomize base with per-env overlays, or a Helm chart with per-env values files, each referenced by a separate Application (often generated by an ApplicationSet Git generator). Promotion moves a tested revision/tag from one env's config to the next via PR, keeping environments consistent yet independently controllable.
generators:
- git:
files:
- path: envs/**/config.json
Real-world example
A Git-file ApplicationSet generates dev, staging, and prod Applications from per-env config files, each pinning its own tag.
Multi-cluster
App of Apps
Applications
The argocd CLI manages apps: `argocd app list`, `argocd app get <name>`, `argocd app sync <name>`, `argocd app diff <name>`, `argocd app history`, and `argocd app rollback`. It's used for automation and troubleshooting alongside the web UI and the declarative Application CRs.
argocd app get guestbook
argocd app sync guestbook
argocd app diff guestbook
Real-world example
An engineer runs `argocd app diff` in CI to preview changes before approving a production sync.
Sync & Health
GitOps Principles
Applications
Newer ArgoCD supports multiple sources in one Application, letting you combine, for example, a Helm chart from one repo with values from another repo, or reference resources across repos. This decouples chart source from environment config and supports patterns like using a shared chart with team-owned values.
spec:
sources:
- repoURL: https://charts.example.com
chart: app
targetRevision: 1.2.0
helm:
valueFiles: ['$values/prod.yaml']
- repoURL: https://github.com/org/config
targetRevision: main
ref: values
Real-world example
The app renders a public Helm chart but pulls its production values from a separate, access-controlled config repo.
GitOps Principles
Multi-cluster
Applications
Use sync-options annotations: `Prune=false` stops deletion, and for out-of-band or one-time resources you can annotate to skip dry-run or apply behavior. For resources you want created if absent but not overwritten, options like `Replace=false` and selective ignoreDifferences help. This balances declarative ownership with pragmatic exceptions.
metadata:
annotations:
argocd.argoproj.io/sync-options: Prune=false
Real-world example
A shared ConfigMap seeded once is annotated Prune=false so removing it from Git doesn't delete the live data.
Sync Waves & Hooks
Sync & Health
Applications
Check `argocd app get` for resource-level status and messages, view the diff to see what's out of sync, inspect events and pod/controller logs, verify health checks (custom resources may need Lua health scripts), and confirm no sync hooks or waves are blocking. Common causes: failing readiness probes, missing CRDs, RBAC denials, or resources mutated outside Git.
argocd app get my-app --refresh
argocd app resources my-app
kubectl describe <resource> # events/conditions
Real-world example
An app stuck Progressing is traced to a failing readiness probe; fixing the health check clears it to Healthy.
Sync & Health
Sync Waves & Hooks
Applications