GitOps with FluxCD

Flux Overview

FluxCD Concepts amp Terminology

Prerequisites

This guide assumes you're familiar with GitOps, Docker, Kubernetes, and CI/CD workflows.

Key Concepts Overview

Below is a quick reference of FluxCD’s core components and GitOps terminology.

ConceptController / CommandPurpose
Bootstrappingflux bootstrapInstalls Flux controllers and Git repository sources.
Agent / ControllerReconciliation loopsWatches CRDs and aligns cluster state with Git definitions.
SourceGitRepository, HelmRepository, OCIRepositoryFetches and tracks external repositories.
KustomizationKustomizationApplies and reconciles overlays or plain manifests.
ReconciliationContinuous processEnsures actual cluster state matches Git’s desired state.
Suspend & Resumeflux suspend / flux resumePauses or restarts automatic reconciliation.
PruneAutomatic cleanupRemoves resources no longer defined in the source.
Image Automationflux imageUpdates Git when new container images are available.

1. Bootstrapping

Bootstrapping is the initial step to install Flux components on your Kubernetes cluster.
Use the flux bootstrap command to connect your cluster with a Git repository following GitOps best practices.

2. Agent / Controller

Flux controllers (or agents) implement Kubernetes’ controller pattern:

  • They run reconciliation loops.
  • Watch for custom resources (CRDs).
  • Continuously compare and reconcile the cluster’s actual state against Git-defined desired state.

3. Sources

Sources define where Flux retrieves configuration or package artifacts:

  • GitRepository: Monitors a Git repo for YAML manifests or Kustomize overlays.
  • HelmRepository: Tracks Helm charts.
  • OCIRepository: Fetches Helm charts or container images from an OCI registry.

4. Kustomization

The Kustomization controller applies a set of overlays or plain manifests:

  • Applies resources to the cluster.
  • Continuously reconciles updates.
  • Supports features like patches, generators, and strategic merges.

5. Reconciliation

Reconciliation is Flux’s core mechanism:

  • Compares the actual state of your cluster with the desired state defined in Git.
  • By default, reconciliation runs automatically at each interval.
  • You can temporarily suspend or resume this process.

Warning

Suspending reconciliation in production may delay critical updates. Always verify before pausing.

6. Suspend & Resume

Use the Flux CLI to manage reconciliation:

flux suspend kustomization webapp
flux resume kustomization webapp

When suspended, manual intervention via flux reconcile is required to apply changes.

7. Prune

Pruning ensures your cluster stays clean:

  • When enabled, Flux automatically deletes Kubernetes resources that are no longer defined in the Git source.
  • Helps prevent resource drift and orphaned objects.

The image is a table explaining FluxCD concepts and terminology, including terms like Bootstrap, Agent, Controller, Sources, Kustomization, Reconciliation, Suspend, Resume, Prune, and Image. It includes brief definitions for each term.

8. Flux Image Automation

The flux image command manages image automation objects:

  • Image Reflector Controller: Monitors container registries for new tags.
  • Image Automation Controller: Commits updated image references to your Git repository.

Common Commands

# Watch for new images in a registry
flux create image repository my-app \
  --image=myregistry/my-app \
  --interval=1m

# Automate Git updates when a new image is available
flux create image automation my-app \
  --image-ref=ImageRepository/my-app \
  --update-path="./deploy" \
  --interval=5m

References

Watch Video

Watch video content

Previous
WhatWhyHow FluxCD