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

DeveloperGit repoCIGitOps agent (in cluster)ClusterPR: bump image tagtests pass, mergepoll / webhook: new commitapply manifestscompare live vs gitstatus: Synced, Healthy
Pull-based deployment from Git.

Argo CD vs Flux

Argo CDFlux
ModelCentral server with UIControllers per cluster
UIRich built-in web UICLI-first; UIs available separately
Multi-clusterOne Argo CD managing many clustersFlux per cluster, often bootstrapped from one repo
Helm / KustomizeYesYes (HelmRelease, Kustomization)
Image update automationArgo CD Image UpdaterBuilt-in image automation controllers

Promotion workflow

  1. App repo: code + CI builds an image tag
  2. Config repo: manifests per environment
  3. Promotion: PR updates tag in staging, then prod
  4. Agent syncs each environment from its path or branch
  5. Rollback: revert the commit
Environment promotion with GitOps.

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: true

Promote 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 --fill

Common 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.

More DevOps articles