Use this when Git is the source of truth and an agent keeps the live system in sync.
GitOps
GitOps uses a Git repository as the source of truth for declarative infrastructure and application configuration, with an agent like Argo CD or Flux continuously reconciling the live system to match it.
1. GitOps: git is the source of truth; agents reconcile targets.
3. Changes via PRs.
4. Drift auto-corrected.
5. Rollback with git revert.
PR → merge → agent pulls → reconcile → target
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 Target-state verification ladder Verify boundary
GitOps uses a strict target-state ladder for Git desired state to reconciler effective state: request accepted → job/task succeeded → target object changed → effective runtime state confirmed → original workload verified.
Step 2 Verification path Verify boundary
Verify GitOps across both source and target. Record the commit/revision intended for the environment, show the reconciler fetched and accepted that revision, inspect render/validation results, and correlate the controller object/status to the specific target resources it owns. After reconciliation, query target generation/version/health independently rather than assuming a “Ready” controller condition fully represents service health. Introduce a safe drift change to a managed property and verify whether the controller detects/reverts it according to policy; also test an invalid declaration to show it fails before harmful mutation. For promotion, verify the environment actually runs the intended artifact/config revision. The complete chain is Git revision → reconciler revision → applied target state → consumer/service verification.
Step 3 Where it fails Narrow the fault
The boundaries are Git/source availability and revision selection → rendering/generation → policy/schema validation → reconciler/controller → target API apply → target controller convergence → application/service health. A source commit existing does not show it was selected; a successful apply does not show workload health; and a healthy workload does not show the expected revision is running. Field ownership conflicts can create persistent drift even when both controllers are healthy. Do not “fix” reconciliation by editing managed target state unless intentionally suspending ownership. Preserve source revision and controller status before intervention. After remediation, re-run reconciliation and confirm both desired revision and independent service state.
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.
Subtopics
Go one level deeper into this subject.
GitOps fundamentals: declarative configuration stored in Git, changes through pull requests, automated pull-based deployment by an agent, and continuous reconciliation of the live state.
Subtopic Git as Source of TruthGit as source of truth means the repository is the only place configuration is changed.
Subtopic Declarative ConfigurationDeclarative configuration describes what the system should look like, such as Kubernetes manifests or Terraform files, rather than the steps to get there, which makes GitOps reconciliation possible.
Subtopic Desired StateDesired state in GitOps is the configuration committed to the Git repository; the GitOps controller continuously works to make the live system match it.
Subtopic ReconciliationReconciliation is the controller's continuous loop of comparing desired state in Git with actual state and applying changes until they match.
Subtopic Pull-based DeploymentPull-based deployment has an agent inside the target environment, such as Argo CD or Flux, pull changes from Git and apply them, so CI never needs credentials to the cluster.
Subtopic Drift DetectionDrift 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.
Subtopic Change ReviewChange review in GitOps means every change to infrastructure goes through a pull request with review and automated checks before merge, which then triggers deployment.
Subtopic RollbackRollback in GitOps is done by reverting the commit in Git, after which the controller reconciles the system back to the previous configuration, with full history of what changed.
Subtopic Environment PromotionEnvironment promotion moves a change from dev to staging to production by updating each environment's configuration in Git, through pull requests or automated image updates.
Subtopic GitOps TroubleshootingTroubleshoot GitOps by checking the controller's sync status and events, the rendered manifests, repository access, Helm or Kustomize errors, and resources changed outside Git.
- Change Git, not the live system.
- The controller reconciles continuously.
- Rollback is a Git revert.
argocd app list— Argo CD apps and sync statusflux get all -A— Flux resourcesgit log --oneline -5 -- <env path>— changes to environment
ReferenceWhy it matters1 section · depth on demand
In depth
GitOps is an operating model where the desired state of systems lives in Git and automated agents continuously reconcile live systems with it. Every change is a pull request, giving review, audit and rollback by revert.
| Component | Example |
|---|---|
| Git repository | Manifests, Helm charts, Kustomize, config data |
| Reconciler | Argo CD, Flux |
| Target | Kubernetes clusters (also network/infrastructure) |
| Policy | Branch protection, required reviews |
The agent pulls from Git, so clusters need no inbound access from CI and credentials stay inside the environment.
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
GitOps applies a reconciliation control loop to declarative, versioned desired state. The OpenGitOps model emphasizes four properties: declarative intent, versioned/immutable storage, automatic pull by software agents, and continuous reconciliation of actual state toward desired state. The Git repository is therefore not the runtime controller; an agent/controller resolves a source revision, renders or interprets declarations, compares them with target state and applies changes according to its own ordering, health and retry semantics. Source revision, generated manifests and target observed state are separate artifacts. A merged commit may never reconcile because source access, rendering, policy or target authorization fails. Conversely, manual target changes may be reverted automatically because the controller continues to own the declared fields.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Define repository boundaries, protected branches, review policy, signing/attestation where required, reconciliation ownership and environment promotion strategy. Pin or version generators, charts/modules and controller configuration so the same source revision is reproducible. Secrets should use an explicit encrypted/external-secret model rather than plain repository storage. Decide how emergency/manual changes are handled: either they are rapidly represented back in Git, intentionally suspended, or recognized as drift that the controller will revert. Controller upgrades and CRD/schema changes require compatibility testing. Maintain a recovery path for lost controller state that can rebuild from versioned declarations without relying on undocumented in-cluster edits. Retain reconciliation history and source revision linkage for incident analysis.
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. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://opengitops.dev/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Quick lookup tables
→ GitOps · operational reference
Context-specific ownership, verification, output and failure-boundary lookup for → GitOps.
| Layer | GitOps operational reference |
|---|---|
| Runtime/ownership | OpenGitOps principles / reconciliation controllers · identify controller/worker/target ownership before mutation |
| Persistent intent | Versioned configuration/playbook/workflow with explicit dependencies and least-privilege identity |
| Verification | git rev-parse HEAD; inspect reconciler source revision/status; query target resource generation/status independently |
| Expected interpretation | Desired state is declarative, versioned/immutable, pulled automatically and continuously reconciled; the reconciler revision and target observed state agree or expose a clear drift/error. |
| Recovery boundary | Preserve correlation IDs + pre-state, then verify target/service independently after remediation |
Deep reference
Healthy vs suspicious evidence
Output interpretation
GitOps output should preserve repository URL, commit/revision, reconciliation object/controller identity, rendered artifact or digest, target resource IDs, observed generation, health/condition state, last attempted/applied revision and error reason. Human-friendly “Synced/Ready” summaries are useful but should link to these structured fields. Distinguish source fetch errors, render/schema errors, policy rejection, apply conflicts, health timeout and target-service failure. When controllers retry continuously, retain first-failure time and attempt metadata so a flapping system is not mistaken for a single event. Diff output must show which fields are controller-owned versus ignored/external. Avoid logging decrypted secrets while preserving enough object identity to show what changed.