How Flux Implements GitOps for Kubernetes

Updated

Flux implements GitOps by treating a Git repository as the single source of truth for your Kubernetes cluster. You declare the desired state of your system — applications, configuration, dashboards, monitoring, and other resources — in Git using YAML. Flux then continuously pulls that state and reconciles it against the cluster, so changes are applied automatically without running kubectl by hand. This model fits teams that want auditable, declarative delivery for both apps and infrastructure on any Kubernetes distribution.

The core mechanism: pull, reconcile, repeat

Flux runs inside the cluster and watches your declared sources. The loop works like this:

  1. Declare — You commit the desired state to Git as YAML manifests.
  2. Pull — Flux fetches from your Git provider (GitHub, GitLab, Bitbucket, or even S3-compatible buckets as a source).
  3. Reconcile — Flux compares the declared state with what's actually running and applies the difference.
  4. Repeat — Reconciliation runs continuously, so drift is corrected automatically.

Because Flux pulls rather than waiting for an external system to push, it needs fewer privileges and aligns with Kubernetes security policies. The site describes this as a "pull vs. push" design with least-privilege access.

What you can manage

Flux is not limited to application deployments. The declared system state can include:

  • Applications and their configuration
  • Dashboards and monitoring
  • Any Kubernetes resource
  • Infrastructure and workload dependencies, with dependency management built in

This is why Flux is described as GitOps for both apps and infrastructure, rather than a deployment-only tool.

Auditability through pull requests

Every change flows through a pull request. That gives you two things:

  • A transaction history — Your Git history is a sequence of changes, so you can recover state from any snapshot.
  • Review before apply — Changes are visible and reviewable before they reach the cluster.

If something goes wrong, you revert the commit rather than manually undoing cluster changes.

Progressive delivery with Flagger

Flux handles continuous delivery (CD). For progressive delivery (PD), it works alongside Flagger to roll out apps with canaries, feature flags, and A/B rollouts. This lets you release gradually and shift traffic based on observed behavior rather than switching all users at once.

Automated image updates back to Git

Flux can push back to Git for you. It scans container images and patches the manifests with updated image references, so a new image tag becomes a Git commit — keeping the repository as the source of truth even for version bumps. This closes the loop: image updates are auditable commits like any other change.

Tool and platform compatibility

Area Support
Git providers GitHub, GitLab, Bitbucket, S3-compatible buckets
Container registries All major registries, fully integrated with OCI
CI workflows All CI workflow providers
Kubernetes tooling Kustomize, Helm
Webhooks GitHub, GitLab, Harbor, custom webhooks
Notifications Slack and others

Flux is a CNCF Graduated project, and its APIs are stable. It works with any Kubernetes and supports multi-tenancy through true Kubernetes RBAC via impersonation, plus multiple Git repositories. Multi-cluster infrastructure and apps work out of the box with Cluster API — one cluster can manage apps in the same or other clusters, spin up additional clusters, and manage cluster lifecycle and fleets.

When this approach fits

Choose Flux's GitOps model when you want:

  • A single declarative source of truth in Git for apps and infrastructure
  • Automatic reconciliation instead of manual kubectl changes
  • Pull-request-based review and a recoverable Git history
  • Progressive delivery via Flagger and automated image updates back to Git

If your workflow depends on imperative cluster changes or you cannot grant a controller in-cluster access to your Git sources, the pull-based model will need adjustment before it fits.