The flux CLI

The command families that actually get used in production: reconcile, suspend, resume, trace, diff, build, check, logs, events, tree, stats, and the export-then-commit workflow that keeps the CLI GitOps-correct.

Overview

What the flux CLI is

The flux CLI is the operational surface of Flux v2: a single Go binary with no daemon, no local state and no privileged access beyond your kubeconfig. Every subcommand resolves to one of four operations against the Kubernetes API.

  • Create or delete a Flux resource.
  • Read one, with get, trace, tree and events.
  • Annotate one, with reconcile, suspend and resume.
  • Render locally, with build and diff.

The first three go through the Kubernetes API. The fourth renders manifests on your machine, so you can see a change before it lands.

> [!WARNING] Engineers who have only read the quickstart tend to believe flux reconcile deploys code. It does not; interviewers probe this.

Key concepts

  • reconcile.fluxcd.io/requestedAt
  • flux reconcile --with-source
  • flux suspend and flux resume
  • flux trace
  • flux build kustomization
  • flux diff kustomization
  • --export
  • flux check versus flux check --pre

Interview questions

  • What exactly does flux reconcile do, and how does it relate to spec.interval?
  • A Deployment appeared in production that nobody recognizes. How do you find out what put it there?
  • How do you review a Flux manifest change before it merges, and why is plain kustomize build not enough?
  • Production is down and you need to make a manual change. Walk through it with Flux in the loop.
  • Why is flux create considered an anti-pattern in a GitOps setup, and what is the correct workflow?
  • flux get shows a Kustomization as not ready. Walk through your CLI debugging sequence.

Sign up free to read the full topic

More DevOps topics

Start free on Cariara · Coding problems · System design studio