Interview's MateKubernetes
Interview's Mate

Kubernetes

K8s · Workloads · GitOps · Cloud

Visualizer

DSA Visualizer
All 32 lessons
Custom Playground
Try your own examples

Learning

System Design
31 architecture topics
SQL Learning
160 foundations → production topics
AI Engineering
160 LLM → backend topics
Data Science
160 Python → MLOps topics
Data Engineer
160 SQL → streaming topics
Docker
160 Docker learning topics
Kubernetes
160 K8s fundamentals → cloud
Java LearnSoon
Coming soon
Python Learn
Interview Q&A & internals
JavaScript Learn
Closures, async & DOM Q&A
Tech Learn
Search, practise & track Q&A
AI DSA Practice
Solve coding problems
Theme
Home
Kubernetes topics
Lesson 95/ 160
05. Configuration, Packaging & GitOps

Sync Waves, Hooks & Drift Detection in Argo CD

Order syncs with waves/hooks and detect configuration drift automatically.

AdvancedSync Waves · Hooks · Drift3 quiz questions
Practice DevOps Q&A
In plain wordsDiagramTheoryStep by stepWhen to use itInterview cluesMistakes to avoidQuiz (3)Practice

In plain words

Sync waves are numbered boarding groups, and hooks are timed gate checks that run before, during, or after passengers enter. The simple Kubernetes rule is: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Think of it like…

Sync waves are numbered boarding groups, and hooks are timed gate checks that run before, during, or after passengers enter.

Where you’ve seen it

A platform team reviews a promoted source revision and runs argocd app wait checkout --health; argocd app sync checkout --prune --async. Expected evidence: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state. If the run instead shows this symptom, stop and restore the last known state: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.

Words you’ll hear

Sync Waves
For this lesson, Sync Waves is the controlling idea: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.
Hooks
Hooks is the checkpoint; run argocd app wait checkout --health; argocd app sync checkout --prune --async and inspect the owner chain. Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.
Drift
Drift is the outcome to preserve; the cost is explicit: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.
Verification evidence
The evidence command is argocd app wait checkout --health; argocd app sync checkout --prune --async. It connects the declaration to this behavior: Order syncs with waves/hooks and detect configuration drift automatically.

Visual diagram

Loading interactive diagram

Theory & deep dive

How Sync Waves reaches the intended state

Order syncs with waves/hooks and detect configuration drift automatically. Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

The concrete checkpoint is argocd app wait checkout --health; argocd app sync checkout --prune --async; compare the Sync Waves owner, Hooks state, and Drift outcome instead of treating YAML acceptance as proof.

Verify Hooks, not only object creation

Run argocd app wait checkout --health; argocd app sync checkout --prune --async after the change and correlate the result with Events and the owning object. Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Key takeaway: Sync Waves is implemented only when this invariant remains observable: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Hooks: failure boundary and production cost

Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed. The prerequisite contract is concrete: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations. A safe design limits blast radius, records the last good configuration, and uses argocd app wait checkout --health; argocd app sync checkout --prune --async as a deterministic rollback checkpoint.

Recover from Hooks drift

Capture the current state with argocd app wait checkout --health; argocd app sync checkout --prune --async, then correct the controlling manifest rather than patching a child object; the relevant divergence signal is specific: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.

Key takeaway: Accept the trade-off consciously: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.

How it works, step by step

Step 1 of 4
Source author

1. Choose the source of truth

Version the source and describe the review, render, and reconciliation boundary: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Sync Waves contract → owned state
Key numbers at this step
Goal
Order syncs with waves/hooks and detect configuration drift automatically.
Owner
Sync Waves

When to use it & trade-offs

What it is

Order syncs with waves/hooks and detect configuration drift automatically. Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Why it matters: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed. The invariant at risk is specific: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state. The quickest fact check before changing the design is argocd app wait checkout --health; argocd app sync checkout --prune --async.

When to reach for it

  • Use Sync Waves to enforce this invariant: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.
  • Use Hooks evidence from argocd app wait checkout --health; argocd app sync checkout --prune --async in reviews and incident timelines. Order syncs with waves/hooks and detect configuration drift automatically.
  • Choose the platform operator workflow route only when this cost is justified by governance or scale: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.

When to avoid or be careful

  • Avoid assuming Sync Waves is complete after YAML submission; the required behavior is concrete: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.
  • Avoid treating the next symptom as random; check the owner and state with argocd app wait checkout --health; argocd app sync checkout --prune --async first: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.
  • Avoid adopting a heavier platform wrapper before measuring its cost: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.

Native, manual, and managed paths for Sync Waves

Versioned declarative source
Best for: Order syncs with waves/hooks and detect configuration drift automatically. A concrete incident check is argocd app wait checkout --health; argocd app sync checkout --prune --async.

Strengths: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Watch out: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations. Recovery must also recognize this signal: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.

Imperative cluster edit
Best for: Quickly testing the Hooks assumption with argocd app wait checkout --health; argocd app sync checkout --prune --async; the expected invariant is: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Strengths: argocd app wait checkout --health; argocd app sync checkout --prune --async gives immediate feedback without first building a platform layer.

Watch out: A manual change can hide drift, and unlike Sync Waves, it does not make this symptom self-documenting: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.

Platform operator workflow
Best for: Teams that need Drift integrated with guardrails; the evidence path is argocd app wait checkout --health; argocd app sync checkout --prune --async.

Strengths: Platform controls can wrap this exact behavior in policy or dashboards: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.

Watch out: The added platform ownership buys value at this cost: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.

Interview signals & numbers to know

When this topic comes up

  • Interview anchor: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.
  • Trace Sync Waves to Drift through Hooks; the invariant is: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.
  • Recognize the symptom: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.
  • Justify the cost: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.
  • Verify with argocd app wait checkout --health; argocd app sync checkout --prune --async instead of only inspecting YAML.

Benchmarks & rules of thumb

3 -
hook phases: PreSync, Sync, and PostSync
0 -
default wave values can be omitted
2 -
states compared on every review: Git target and live cluster drift

Common mistakes & follow-ups

Common interview mistakes

  • Debugging only the child object misses the Sync Waves owner contract: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state.
  • Ignoring this telltale condition leads to unrelated changes: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed.
  • Repeating argocd app wait checkout --health; argocd app sync checkout --prune --async without an owner for remediation wastes retry cost. Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.

Likely interviewer follow-ups

  • How would API output and runtime evidence prove this behavior: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state?
  • Which owner object, logs, and Events would you inspect for this symptom-Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed-?
  • At what threshold would this cost become unacceptable: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations?
Interview tip: Interview sequence: state the invariant, run argocd app wait checkout --health; argocd app sync checkout --prune --async, name the failure, then justify the cost. Invariant: Argo CD sorts resources by sync-wave, runs PreSync, Sync, or PostSync hooks, and reports OutOfSync drift before optional automated sync and prune restore the Git state. Failure: Wave ordering is lexical within a phase and does not guarantee an application's runtime readiness; pruning or a PostSync hook can fail after workloads have changed. Cost: Waves and hooks model dependencies, but a database migration or external system still needs its own atomicity and rollback rather than more sync annotations.

Knowledge check

Loading quiz

Put it into practice

Practice related interview Q&A

Apply Sync Waves, Hooks & Drift Detection in Argo CD with generative AI interview Q&A and hands-on practice.

Open DevOps Q&A →Tech Learn Q&A
Previous topic
Argo CD Architecture, Applications & ApplicationSets
Next topic
Flux CD Architecture & Kustomize/Helm Controllers