Applying Manifests
Overview
Section titled “Overview”The apply workflow does three things in sequence:
- Suspends all Flux kustomizations so Flux does not revert your changes mid-apply.
- Runs
kustomize build <path> | kubectl apply -f -against the cluster. - Resumes every suspended kustomization on exit — regardless of whether the apply succeeded or failed.
The resume step is unconditional. A trap on EXIT (in the mise task) and a finally block (in the CLI command) both guarantee Flux restarts even if you interrupt with Ctrl+C.
CLI command
Section titled “CLI command”kb k apply <path><path> is the Kustomize overlay directory relative to the repo root, for example:
kb k apply apps/overlays/dev/docsThe command requires the flux CLI on your PATH. If it is missing, the command exits immediately with an install hint.
mise task
Section titled “mise task”mise run apply -- <path>The -- separates mise’s own flags from the path argument. For example:
mise run apply -- apps/overlays/dev/docsA shorthand task targets the full dev overlay:
mise run apply-devapply-dev is equivalent to mise run apply -- apps/overlays/dev.
What runs under the hood
Section titled “What runs under the hood”Both interfaces reach the same pipeline:
kustomize build <path> | kubectl apply -f -kustomize build renders the overlay — resolving patches, generators, and base resources — and streams the result to kubectl apply. No intermediate file is written to disk.
The suspend and resume steps call flux get kustomizations to discover every kustomization by name, then run flux suspend kustomization <name> and flux resume kustomization <name> for each one. All suspend calls run in parallel (CLI) or sequentially (mise task); resume is always sequential to avoid racing the Flux controller.
When to use apply
Section titled “When to use apply”Use apply when you want to test a manifest change without committing it first. Common cases:
- Iterating on a deployment spec or ConfigMap during development.
- Applying a single overlay to verify rendered output before pushing.
- Recovering from a broken state where Flux reconciliation would overwrite a manual fix.
After you finish, commit the change and push. Flux will reconcile from Git as normal once kustomizations are resumed.
Choosing between the CLI and the mise task
Section titled “Choosing between the CLI and the mise task”Both forms are equivalent in behavior. The CLI (kb k apply) is more convenient when you are already in the TUI or working across multiple clusters. The mise task (mise run apply) integrates with other mise workflows and is easier to chain in scripts.
- The current kubeconfig context determines which cluster receives the changes. Confirm the active context with
kubectl config current-contextbefore running. - Flux kustomizations are suspended cluster-wide, not scoped to the overlay you are applying. Other team members relying on Flux reconciliation will be affected for the duration.
- If
kustomize buildfails, the apply step does not run, but Flux is still resumed by the exit handler.