How does drift detection and self-healing work in GitOps?
What they are really testing: Whether you understand the reconcile loop comparing git to live state and that self-heal reverts out-of-band changes. A defining GitOps capability people gloss over.
A real interview question
How does drift detection and self-healing work in GitOps?
What most people say
drag me
“It checks if the cluster matches git and updates it if not.”
Roughly right but misses the key behavior and its consequence: self-heal reverts manual changes, so a hotfix done with kubectl gets undone. Not knowing that leads to confusion when fixes vanish.
The follow-ups they ask next
You kubectl edit a resource to hotfix prod and it reverts minutes later. Why?
Self-heal: the GitOps controller detected drift from git and re-applied the declared state, reverting your manual change. The fix must go through git (a commit/PR), not a live edit.
What triggers a reconcile?
A periodic interval plus git webhooks on new commits (and manual sync). The controller then diffs git against live state and, if OutOfSync, applies git (and self-heals if enabled).
What the interviewer is listening for
- Describes the git-vs-live reconcile loop
- Knows OutOfSync detection + self-heal revert
- Knows you must fix via git, not the cluster
What sinks the answer
- Vague "checks and updates"
- Unaware self-heal reverts manual edits
- Still expects to hotfix via kubectl
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“The controller [reconciles on an interval and on git webhooks, comparing git desired state to live cluster state]. On a mismatch it [marks the app OutOfSync and shows the diff]. With [self-heal it re-applies git, reverting out-of-band changes]. So [you cannot hotfix by editing the cluster, it gets reverted, the fix goes through git].”
Keep going with gitops
Foundation
What is GitOps, and what problem does it solve?
Foundation
What is the difference between push-based and pull-based deployment, and why does GitOps prefer pull?
Foundation
What are the core principles of GitOps?
Junior
What are Argo CD and Flux, and how do they differ?
Junior
How do you structure repositories for GitOps? Should app code and deployment config live together?
Mid
How do you promote a change from dev to staging to prod in a GitOps workflow?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free