Skip to content
intermediate Phase 13 · GitOps & CI/CD

Flux CD

Implement Flux CD for GitOps-driven reconciliation and deployment.

1h
0 problems
Topic Progress 0%

Flux Controllers and Bootstrap

Flux Controllers and Bootstrap

Flux is a set of Kubernetes-native controllers, each reconciling its own CRDs on an interval: source-controller resolves Git/OCI/Helm sources into immutable artifacts, kustomize-controller applies Kustomizations, helm-controller upgrades HelmReleases, and notification-controller posts alerts.

Bootstrap a GitHub repository in one command:

flux bootstrap github --owner acme --repository fleet \
  --path clusters/prod --personal=false

This installs the controllers into flux-system, commits the manifests back to your repo (including deploy keys), and starts reconciliation — the repo and cluster are wired together with credentials managed for you.

Kustomization and HelmRelease

Kustomization and HelmRelease

Plain manifests and kustomize overlays:

apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata: { name: platform, namespace: flux-system }
spec:
  interval: 5m
  path: ./infra/platform
  prune: true
  sourceRef: { kind: GitRepository, name: fleet }

Helm charts through the helm-controller:

apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata: { name: redis, namespace: cache }
spec:
  interval: 30m
  chart:
    spec:
      chart: redis
      version: 18.6.1
      sourceRef: { kind: HelmRepository, name: bitnami, namespace: flux-system }

Order dependencies with dependsOn (CRDs/namespaces first) and set wait: true so a Kustomization blocks until resources are Ready before dependents run.

Pitfalls and Interview Angles

Pitfalls and Interview Angles

Prune semantics. prune: true deletes resources removed from the path — powerful and dangerous: a wrong path: or botched refactor removes whatever that Kustomization owns. Review diffs first.

Ownership confusion. Several Kustomizations can fight over an object; flux trace <resource> -n <ns> shows which source and Kustomization own it — debug from there.

Drift, like Argo. Manual edits revert on the next interval; flux get kustomizations --watch shows reconcile state, and flux suspend pauses a loop during incidents.

Source staleness. Changes propagate only after source-controller re-fetches — the source interval bounds that latency; flux reconcile source git fleet forces a fetch now.

Interview angle: contrast Flux (granular CRDs, flux CLI, HelmRelease) with Argo CD (Application model, UI-first) and pick a fit.

Quiz

1. Which Flux controller renders and applies Kustomizations?

Question 1 options

2. What does prune: true do on a Kustomization?

Question 2 options

3. How do you find which Flux object owns a given resource?

Question 3 options

Flashcards

Question

Flux controller set

Answer

source (fetch Git/OCI/Helm), kustomize (apply), helm (chart releases), notification (events/alerts).

Question

flux bootstrap

Answer

One-command install: controllers, Git source, deploy keys, and a committed fleet config.

Question

HelmRelease

Answer

Helm-controller CRD reconciling a chart from a HelmRepository/OCI source at an interval with pinned version.

Question

dependsOn / wait

Answer

Orders Kustomizations; wait: true blocks until resources are Ready before dependents reconcile.

Revision Notes

Key Takeaways

  • 1. Flux = granular controllers reconciling Git-sourced artifacts on intervals
  • 2. Kustomization applies manifests (with prune); HelmRelease manages charts with pinned versions
  • 3. flux get --watch and flux trace are the primary debugging tools; manual edits revert

Interview Tips

  • • Compare Flux and Argo CD on resource model, UI, and operational philosophy
  • • Explain how you would order infra → platform → app deployment with dependsOn and wait

Cheat Sheet

flux bootstrap → source/kustomize/helm/notification controllers. Kustomization{interval, path, prune} + HelmRelease{chart version, values}. Debug: flux get --watch, flux trace.

Continue Learning