Skip to content

Applying Manifests

The apply workflow does three things in sequence:

  1. Suspends all Flux kustomizations so Flux does not revert your changes mid-apply.
  2. Runs kustomize build <path> | kubectl apply -f - against the cluster.
  3. 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.

Terminal window
kb k apply <path>

<path> is the Kustomize overlay directory relative to the repo root, for example:

Terminal window
kb k apply apps/overlays/dev/docs

The command requires the flux CLI on your PATH. If it is missing, the command exits immediately with an install hint.

Terminal window
mise run apply -- <path>

The -- separates mise’s own flags from the path argument. For example:

Terminal window
mise run apply -- apps/overlays/dev/docs

A shorthand task targets the full dev overlay:

Terminal window
mise run apply-dev

apply-dev is equivalent to mise run apply -- apps/overlays/dev.

Both interfaces reach the same pipeline:

Terminal window
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.

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-context before 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 build fails, the apply step does not run, but Flux is still resumed by the exit handler.