A complete guide to the Flux CLI: installation across platforms and shell completion, the essential flux check and flux get commands, create and reconcile commands, export, diff, trace, tree, stats, and output tips.

In episode 4 you successfully installed FluxCD via flux bootstrap github and verified it with flux check. From now on, flux is no longer a one-off command — it's your main dashboard for working with FluxCD every day.
This episode covers the Flux CLI thoroughly: installation across platforms, shell completion, essential commands for inspecting and reconciling, create commands for declaring resources, and the export, diff, trace, tree, and stats commands for debugging. After this episode, you'll be comfortable reading cluster status without opening kubectl at all.
If it isn't already installed from episode 0, here's how to install it on various platforms.
brew install fluxcd/tap/fluxcurl -s https://fluxcd.io/install.sh | sudo bashThis script can also be run directly for all distros. Another alternative is downloading the binary from the GitHub releases page.
flux version
source <(flux completion bash)Tip
To keep completion after the terminal closes, add the line source <(flux completion bash) to your ~/.bashrc (for zsh use flux completion zsh). Tab-completion saves a lot of typing when entering long options.
Check component health and cluster connectivity:
flux check
flux check --pre--pre checks prerequisites before installation, while running it without flags checks all installed controllers.
The most frequently used command to see resource status:
flux get sources git
flux get kustomizations
flux get helmreleasesThe output shows the READY, STATUS, and age of the last reconciliation. This is the fastest way to answer "why hasn't the app appeared yet?".
View logs from all controllers at once:
flux logs --level=error
flux logs --kind=Kustomization --name=web-appUseful when a Kustomization fails and you need an error trail without guessing which pod to log.
Normal reconciliation runs on its interval, but sometimes we need instant action:
flux reconcile kustomization web-app --with-source
flux suspend kustomization web-app
flux resume kustomization web-app--with-source forces the source to be re-fetched before reconciliation. flux suspend stops reconciliation — useful during maintenance or when you want to hold changes temporarily.
The Flux CLI can declare resources directly from the terminal, without writing YAML files:
flux create source git web-app \
--url=https://github.com/acme/web-app \
--branch=main
flux create kustomization web-app \
--source=web-app \
--path=./deploy \
--prune=true
flux create helmrelease nginx \
--source=HelmRepository/ingress-nginx \
--chart=nginxThe flux create tenant command creates a namespace plus RBAC for multi-tenancy:
flux create tenant web-team --with-namespace=webImportant
flux create outputs the manifest YAML to the terminal or a file, not directly to the cluster, unless you add --export and kubectl apply. Recommended pattern: generate, review, commit to Git, then let FluxCD apply it through reconciliation.
Once a resource is already running in the cluster, export it back to YAML so it can be committed to Git:
flux export kustomization web-app
flux export source git web-app > web-app-git.yamlVery useful debug commands:
flux diff kustomization web-app — compares the state in Git with what's in the cluster.flux trace deployment nginx -n web — traces which object manages a resource.flux tree kustomization web-app — shows the object dependency tree.flux stats --namespace=web — concise per-namespace resource statistics.flux diff kustomization web-app
flux trace deployment nginx -n web
flux tree kustomization web-appA few tricks that speed up daily work:
--watch or -w, e.g. flux get kustomizations -w which continuously refreshes output.-o yaml or -o json for structured output, e.g. flux get sources git -o json — handy for parsing by other tools.--label-selector, e.g. flux get kustomizations --label-selector=env=prod.-n or --namespace to limit output, e.g. flux get helmreleases -n web.With this episode, you have full control of FluxCD from the terminal:
flux check, flux get sources git, flux get kustomizations, flux get helmreleases, and flux logs.flux reconcile, flux suspend, and flux resume to control reconciliation.flux create source git, kustomization, helmrelease, and tenant.flux export, flux diff, flux trace, flux tree, and flux stats.In episode 6 we move into the real first deployment phase: creating your first GitRepository and Kustomization, deploying an application to the cluster from Git, and understanding the end-to-end reconciliation flow. All the commands you mastered in this episode will be used continuously there. See you!