Use this when the GitOps controller shows OutOfSync.
Drift Detection · GitOps
Drift detection in GitOps is done by the controller comparing live resources with Git, showing OutOfSync status in Argo CD or Flux and optionally correcting it automatically.
1. Drift: live state differs from git.
2. Self-heal reverts it.
3. Alert on OutOfSync.
4. Find who changed live resources.
5. Ignore expected diffs (HPA replicas) explicitly.
live change → drift detected → self-heal/alert
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as wrong branch/environment, generated manifest drift, controller lag, manual changes, secret/reference failures, prune/delete surprises and green sync status without healthy workload, choosing the cases most relevant to scheduled/event-driven desired-versus-actual reads, normalized diff, ignored fields, freshness and creating a reviewable drift record before remediation.
Step 2 Common mistakes Narrow the fault
- Drift alerts ignored.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- OutOfSync means live differs from Git.
- Find who changed the live resource.
- Self-heal can revert automatically.
argocd app list | grep OutOfSync— drifted appsflux get kustomizations | grep -v True— not ready- selfHeal enabled — auto-correct
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
Drift detection in GitOps identifies differences between what Git says and what is actually running. Drift happens through manual changes (kubectl edit), other controllers modifying resources, or failed syncs.
Typical states in Argo CD:
| Status | Meaning |
|---|---|
| Synced | Live state matches Git |
| OutOfSync | Differences exist |
| Healthy / Degraded | Whether resources are working |
Some fields change legitimately at runtime (replica counts set by an autoscaler, defaults added by the API server). Configure ignore rules for those, or the application shows permanent drift and real drift goes unnoticed.
spec:
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers: [/spec/replicas]
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in GitOps > Drift Detection. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://opengitops.dev/ · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For scheduled/event-driven desired-versus-actual reads, normalized diff, ignored fields, freshness and creating a reviewable drift record before remediation, prefer typed fields and stable IDs over human presentation text.