GitOps: Declarative Infrastructure for Modern Teams

📅 October 22, 2019
⏱️ 2 min read

How GitOps principles enable consistent, auditable, and automated infrastructure deployments at scale.

GitOps extends the idea that Git is the single source of truth from application code to infrastructure and cluster state. When you declare desired state in version control and let a controller reconcile reality against it, you gain auditability, rollback capability, and a workflow developers already understand.

The Core Loop

Define infrastructure and application manifests in Git. A CI pipeline validates and merges changes. A GitOps operator (Argo CD, Flux, or similar) continuously compares the live cluster against the declared state and applies diffs. Drift is visible and correctable. Every production change has an author, a reviewer, and a commit hash.

What Belongs in Git

Kubernetes manifests, Helm values, Kustomize overlays, Terraform modules consumed by pipelines, and policy definitions all fit naturally. Keep secrets out of plain Git: use sealed secrets, external secret operators, or vault integrations. Structure repositories by environment or by application, but be consistent so on-call engineers know where to look at 2 AM.

Practical Lessons From the Field

Start with one non-critical workload. Prove the promotion path from dev to staging to production. Add progressive delivery and automated sync only after the basics work. GitOps pairs well with platform engineering: golden paths become Git templates that teams fork and customize within guardrails.

The goal is not more YAML. The goal is predictable, reviewable change at the speed your business requires.

Repository Structure

Separate repos for infrastructure, application manifests, and policy. Use environment branches or overlay directories with Kustomize. Avoid one giant repo that requires every team to have write access to production configuration.

Handling Secrets in GitOps

Never commit plaintext secrets. Use sealed secrets, external secrets operators, or cloud-native secret stores referenced from manifests. Rotate credentials on a schedule and automate the rotation through the same GitOps pipeline.

Rollback Strategy

Git revert is your rollback. Tag releases that reach production. Practice rollbacks in staging so on-call engineers know the steps before an incident forces them to learn.

Common Pitfalls

Auto-syncing to production without approval gates causes incidents. Storing secrets in Git, even encrypted poorly, creates risk. Monolithic repos where every team shares write access lead to accidental cross-team changes. Drift detection without remediation process just generates noise.

Getting Started

Pick one non-critical application and one environment. Set up Argo CD or Flux with a simple repo structure. Practice a full promotion cycle from dev to staging. Document the workflow and train one product team before expanding platform-wide.

Topics & Tags
GitOps Kubernetes ArgoCD Flux CI/CD DevOps