DevOps / ArgoCD interview questions
How do ArgoCD Sync Waves and Sync Hooks work together to control deployment ordering?
ArgoCD provides two complementary mechanisms for controlling the order of resource application during a sync: Sync Waves control the sequence of resource groups, and Sync Hooks inject one-off Jobs at specific lifecycle phases.
Sync Waves
Every resource can be assigned an integer wave via the annotation argocd.argoproj.io/sync-wave. Resources with lower wave numbers are applied first; ArgoCD waits for all resources in wave N to become healthy before advancing to wave N+1. The default wave is 0. Negative waves are useful for CRDs or Namespaces that must exist before other resources reference them.
metadata: annotations: argocd.argoproj.io/sync-wave: "-1" # Namespace first --- metadata: annotations: argocd.argoproj.io/sync-wave: "0" # Default: Deployments, Services --- metadata: annotations: argocd.argoproj.io/sync-wave: "1" # Last: Ingress or smoke-test Job
Sync Hooks
Hooks are Kubernetes resources (usually Jobs) annotated with argocd.argoproj.io/hook. Available hook phases:
| Hook Phase | When it runs |
|---|---|
| PreSync | Before any resources are applied (e.g., database migrations) |
| Sync | During the sync alongside other resources |
| PostSync | After all resources are healthy (e.g., smoke tests, notifications) |
| SyncFail | Only when the sync fails (e.g., rollback alerting job) |
Waves and hooks compose naturally: a PreSync hook runs before wave -1, and a PostSync hook runs after the highest wave reaches healthy. Use argocd.argoproj.io/hook-delete-policy to clean up completed hook Jobs automatically.
More Related questions...