Skip to content

Lesson 7 of 9 · 23m

GitOps Delivery: Git as the Control Plane

How Flux and Argo CD reconcile desired state, why GitOps changes incident response, and the repository patterns that scale beyond one cluster.

GitOps is not simply "YAML in Git." It is a closed loop: Git declares desired state, an in-cluster controller continuously pulls and applies it, and drift is corrected or surfaced. The crucial operational change is direction. Humans stop pushing mutations at clusters; automation pulls reviewed state into them.

Pull-based reconciliation

reviewed commit -> Git repository -> in-cluster reconciler -> Kubernetes API
                                          ^
                                    cluster state diff

Flux and Argo CD differ in interface and ecosystem, but the operating model is similar. A source object points at Git. A kustomization or application object describes what path to apply, how often, and whether pruning is allowed.

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata: {name: payments, namespace: flux-system}
spec:
  interval: 5m0s
  path: ./clusters/prod/payments
  prune: true
  sourceRef: {kind: GitRepository, name: platform}
  validation: client

prune: true means deleting a manifest in Git eventually deletes it in the cluster. This is powerful and dangerous. Pruning makes Git truthful, but it also means a bad merge can delete production resources.

Helm fits, but values belong in Git

For Helm releases, use the GitOps controller's Helm integration rather than running ad hoc helm upgrade commands. The release object declares chart version, source, values files or inline values, interval, and remediation behavior. If an emergency requires a manual Helm command, either reconcile it back into Git immediately or accept that the controller will reverse it.

Repository shapes

A workable production layout separates app definitions from cluster composition:

apps/
  payments/
    base/
    overlays/prod/
clusters/
  prod/
    infrastructure.yaml
    payments.yaml
  staging/

Base plus overlay is not mandatory, but some mechanism for environment differences is. Copying whole directories invites drift. A shared base with explicit environment patches makes differences reviewable.

Incident response changes

In GitOps, the production fix is a commit. The incident channel should contain the PR, not a screenshot of someone running kubectl. Emergency direct changes may still happen, but they are temporary and must be reconciled. Otherwise the next automated sync becomes a surprise rollback.

Field notes

  • Auto-sync without human approval is fine for some environments; production needs a deliberate boundary somewhere.
  • Secrets do not belong in plaintext Git. Use SOPS, External Secrets, or a sealed-secrets model.
  • Diff visibility matters more than the brand of controller. If nobody can review what will change, GitOps has failed socially.
  • Reconciliation loops should be observable: sync failures, drift, and stale sources need alerts.

Was this lesson helpful?

Sign in to rate