The Four Principles
The Four Principles
OpenGitOps distills GitOps into four statements:
- Declarative — desired system state is described as data, not imperative commands
- Versioned and immutable — that description lives in Git: every change is a commit with an author, review, and history
- Automated delivery — agents apply changes automatically; divergence is detected and corrected
- Continuously reconciled — the agent reports and drives the actual state toward the declared state
Practical consequences: git revert is your rollback, PR review is your change advisory board, and cluster state becomes reconstructible from the repository plus an image registry.
Push vs Pull Delivery
Push vs Pull Delivery
Push: CI pipelines run kubectl apply or helm upgrade with cluster credentials. Simple to start — but nothing corrects manual changes afterward, credentials fan out to every pipeline, and history splits across Git and cluster events.
Pull: a controller inside the cluster watches the repository, renders manifests, diffs them against live state, and applies differences — then keeps doing it. A human edit to a Deployment gets reverted (or alerted on) within minutes.
Prerequisites for either style: everything expressively declarative (Helm values, Kustomize overlays), a plan for secrets (SOPS, external secret stores), and no kubectl edit in normal operations — hand edits are exactly the drift the system exists to remove.
Pitfalls and Interview Angles
Pitfalls and Interview Angles
Git-as-backup only. Storing manifests in Git without an applying agent is just versioning — no automation, no reconciliation, no GitOps.
Secrets in plaintext. Git becomes the single most attractive target; encrypt (SOPS) or reference external stores, and protect branches with signed commits.
Double-writers. If pipelines AND a reconciler both apply changes, they fight: pipeline applies v2, reconciler reverts to Git's v1. Pick one writer per cluster — usually the reconciler.
Repo layout mismatches. Overlapping paths between two controllers cause resources to be adopted and pruned by different owners; give each application/env a disjoint path.
Interview angle: define drift concretely (live state ≠ Git state), explain how the pull agent resolves it, and contrast it with what push CI would leave behind after a manual edit.
Quiz
1. Which best describes GitOps' source of truth?
2. What happens when someone kubectl edits a Deployment in a pull-GitOps cluster?
3. Why is push-only CI considered incomplete GitOps?
Flashcards
Question
OpenGitOps principles
Click to reveal answer
Answer
Declarative, versioned/immutable, automated delivery, continuously reconciled.
Question
Pull-based reconciliation
Click to reveal answer
Answer
In-cluster agent diffs Git state against live objects and re-applies divergences continuously.
Question
Drift
Click to reveal answer
Answer
Live cluster state differing from Git-declared state — detected and corrected (or alerted) by the reconciler.
Question
Push vs pull
Click to reveal answer
Answer
Push = CI applies with cluster creds; pull = in-cluster agent owns writes, enabling self-healing and single-writer semantics.
Revision Notes
Key Takeaways
- 1. GitOps = Git as desired state + an agent that reconciles continuously
- 2. Pull models deliver self-healing, auditability, and one writer per cluster
- 3. Secrets strategy and disjoint repo paths are prerequisites, not afterthoughts
Interview Tips
- • Define the four principles and immediately ground them in an operational example each
- • Explain drift with a scenario: someone edits a replica count — what happens, and why that behavior matters
Cheat Sheet
GitOps: declarative + versioned in Git + automated + continuously reconciled. Pull agent diffs live vs Git, reverts drift, git revert = rollback. One writer/cluster; encrypt secrets.
Continue Learning
Before You Start
- No prerequisites listed.