Skip to content
intermediate Phase 13 · GitOps & CI/CD

ArgoCD

Deploy and configure ArgoCD for GitOps-based continuous delivery to Kubernetes.

1h 15m
0 problems
Topic Progress 0%

Application Model and Statuses

Application Model and Statuses

Argo CD is a pull-based CD controller (and UI) that watches Git and compares it to the cluster through an Application CRD:

apiVersion: argoproj.io/v1alpha1
kind: Application
metadata: { name: api-prod, namespace: argocd }
spec:
  project: default
  source:
    repoURL: https://github.com/acme/deploy.git
    path: deploy/overlays/prod
    targetRevision: main
  destination:
    server: https://kubernetes.default.svc
    namespace: api
  syncPolicy:
    automated: { prune: true, selfHeal: true }
    syncOptions: [CreateNamespace=true]

Two orthogonal statuses matter: Sync (live objects match Git's rendered output) and Health (workloads are actually OK — a Synced Deployment can be Degraded while pods crash). CRDs without health checks default to Healthy/Unknown, which is why custom Lua health scripts exist.

Syncing and Scale-Out

Syncing and Scale-Out

Without automation, sync deliberately: argocd app sync api-prod, argocd app wait api-prod --health, argocd app history api-prod. With automated, Argo CD continuously applies differences: selfHeal undoes manual kubectl edits, prune deletes resources removed from Git (both opt-in, both consequential).

Scale to many apps/environments two ways:

  • App-of-apps: a root Application whose path contains only Application manifests
  • ApplicationSet: a generator (git files, list, matrix, cluster) emitting one Application per element — e.g. one per directory under overlays/ or per registered cluster

Projects (AppProject) constrain which repos, clusters, and resource kinds an Application may use — the RBAC boundary for multi-team installs.

Pitfalls and Interview Angles

Pitfalls and Interview Angles

selfHeal vs hand edits. With selfHeal on, operators' kubectl edit fixes are reverted within the refresh window — teach the team to change Git or use kubectl argocd app set --parameter-style hooks; otherwise support tickets become "my fix keeps disappearing."

Prune in shared namespaces. Removing a resource from Git deletes it cluster-wide if the app owns that path — a wrong path or rename can prune a colleague's objects. Keep paths disjoint.

targetRevision=main on prod. Every merge auto-deploys; pin prod to tags for controlled promotion.

Health blindness. Synced ≠ healthy. Confirm with argocd app wait --health or the UI's health column before calling a deploy done.

Interview angle: explain Sync vs Health precisely, walk what self-heal does to a manual replica change, and describe your app-of-apps/ApplicationSet choice.

Quiz

1. An app shows Synced but Degraded. What does that mean?

Question 1 options

2. What does syncPolicy.automated.selfHeal do?

Question 2 options

3. Which resource generates one Application per environment automatically?

Question 3 options

Flashcards

Question

Sync vs Health

Answer

Sync = live matches Git; Health = workload actually working. Both must be green to call a deploy successful.

Question

prune vs selfHeal

Answer

prune deletes objects missing from Git; selfHeal reverts objects changed outside Git. Both opt-in under automated sync.

Question

AppProject

Answer

Argo CD RBAC boundary: whitelists repos, destinations, and resource kinds an Application may touch.

Question

ApplicationSet

Answer

CRD fanning out Applications from generators (list, git, matrix, cluster) for multi-env/multi-cluster delivery.

Revision Notes

Key Takeaways

  • 1. Applications bind a Git path to a cluster namespace; sync and health are independent statuses
  • 2. Automated sync with prune/selfHeal gives self-healing at the cost of forbidding hand edits
  • 3. ApplicationSets/app-of-apps scale the model; Projects bound what each app may modify

Interview Tips

  • • Explain Sync vs Health with an example of each failing independently
  • • Describe exactly what happens to a kubectl-edited replica count when selfHeal is enabled

Cheat Sheet

Application = Git path → cluster ns. Status: Sync (matches Git) × Health (workloads OK). automated: {prune, selfHeal} + syncOptions. ApplicationSet fans out; AppProject scopes RBAC. Prod: pin tags.

Continue Learning