GitOps Explained: Declarative Deployments with Argo CD and Flux
What GitOps is, pull-based reconciliation, Argo CD vs Flux, repository layouts, promotion between environments, drift detection and secrets handling.
Published December 2, 2026
GitOps applies the reconciliation idea of Kubernetes to deployment itself. The desired state of every environment lives in Git, and an agent running in the cluster continuously pulls that state and applies it. Deployments become pull requests, rollbacks become git reverts, and anyone can see exactly what is running by reading the repository.
The concept
The OpenGitOps principles describe four properties: the system is declarative, its desired state is versioned and immutable in Git, changes are pulled automatically by software agents, and those agents continuously reconcile actual state with desired state. Unlike push-based CI deploys, the CI system no longer needs cluster credentials; the in-cluster agent does the applying.
Argo CD and Flux are the two CNCF graduated GitOps tools. Argo CD offers a rich web UI, Application and ApplicationSet resources and multi-cluster management from a central instance. Flux is a set of composable controllers (source, kustomize, helm, notification, image automation) that run in each cluster. Both handle plain YAML, Kustomize and Helm, detect drift and can auto-heal manual changes.
The GitOps flow
Argo CD vs Flux
| Argo CD | Flux | |
|---|---|---|
| Model | Central server with UI | Controllers per cluster |
| UI | Rich built-in web UI | CLI-first; UIs available separately |
| Multi-cluster | One Argo CD managing many clusters | Flux per cluster, often bootstrapped from one repo |
| Helm / Kustomize | Yes | Yes (HelmRelease, Kustomization) |
| Image update automation | Argo CD Image Updater | Built-in image automation controllers |
Promotion workflow
- App repo: code + CI builds an image tag
- Config repo: manifests per environment
- Promotion: PR updates tag in staging, then prod
- Agent syncs each environment from its path or branch
- Rollback: revert the commit
Practical examples
Argo CD Application
Points a cluster namespace at a path in Git.
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata: { name: api-prod, namespace: argocd }
spec:
project: default
source:
repoURL: https://github.com/example/platform-config
targetRevision: main
path: apps/api/overlays/prod
destination: { server: https://kubernetes.default.svc, namespace: prod }
syncPolicy:
automated: { prune: true, selfHeal: true }Flux Kustomization
Reconcile a path from a GitRepository source.
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata: { name: api-prod, namespace: flux-system }
spec:
interval: 5m
sourceRef: { kind: GitRepository, name: platform-config }
path: ./apps/api/overlays/prod
prune: truePromote by pull request
A tiny diff, reviewed and auditable.
cd platform-config/apps/api/overlays/prod
kustomize edit set image example/api=example/api:2.3.1
git commit -am "prod: api 2.3.1" && git push && gh pr create --fillCommon mistakes
- Making manual kubectl changes that the agent then reverts (or that drift silently without selfHeal).
- Storing plain secrets in the config repo.
- One giant repo and Application for everything, making syncs slow and blast radius large.
- Mutable image tags, so Git does not actually describe what runs.
Key takeaways
- GitOps: Git holds desired state; in-cluster agents pull and reconcile.
- Deploys are PRs; rollbacks are reverts.
- Argo CD offers a central UI; Flux offers composable per-cluster controllers.
- Use immutable tags and encrypted or external secrets.
FAQ
Does GitOps replace CI?
No. CI still builds, tests and publishes images; GitOps handles deployment from Git.
How are secrets handled?
With SOPS-encrypted files, Sealed Secrets, or External Secrets Operator pulling from a secret manager.
Is GitOps only for Kubernetes?
It is most common there, but the principles apply to any system with declarative configuration and a reconciling agent.