# flux create kustomization: Apply from a Source

> flux create kustomization tells Flux to apply a path from a source. Reference for --source, --path, --prune, --interval, and the reconcile errors in CI.

Source: https://latchkey.dev/learn/command-reference/flux-create-kustomization  
Updated: 2026-06-30

flux create kustomization creates a Kustomization object that applies a path from a source and keeps it reconciled.

A Kustomization is Flux's apply loop: it takes a path inside a source and continuously applies it to the cluster.

## What it does

flux create kustomization defines a Kustomization custom resource that references a --source (a GitRepository or OCIRepository), applies the manifests under --path, and reconciles on --interval. --prune deletes resources removed from the source.

## Common usage

```Terminal
flux create kustomization podinfo \
  --source=GitRepository/podinfo \
  --path=./kustomize \
  --prune=true \
  --interval=5m \
  --wait=true
```

## Options

| Flag | What it does |
| --- | --- |
| --source <kind/name> | Source to apply from (e.g. GitRepository/podinfo) |
| --path <dir> | Directory in the source to apply |
| --prune | Garbage-collect resources removed from the source |
| --interval <dur> | Reconcile interval |
| --wait | Wait for applied resources to become Ready |
| --depends-on <name> | Order this after another Kustomization |

## In CI

Set --prune=true so deletions in Git propagate to the cluster. --wait=true makes the Kustomization report Ready only when its workloads are healthy, which combined with flux reconcile gives a synchronous deploy you can gate on.

## Common errors in CI

"✗ Kustomization reconciliation failed: kustomize build failed: ... no such file or directory" means --path is wrong. "dry-run failed: ... is forbidden" means RBAC denies the service account that field. "✗ source not found" means the --source kind/name does not match an existing source object.

## Using this in CI

A runner has no kubeconfig, no cached context, and no interactive auth. Every kubectl invocation in CI needs the context supplied explicitly, and most confusing CI failures here are the command running against the wrong cluster or no cluster at all.

```Terminal
# never rely on the ambient context on a runner
kubectl --context "$KUBE_CONTEXT" -n "$NAMESPACE" get pods

# confirm what you are actually connected to before mutating anything
kubectl config current-context
kubectl cluster-info

# fail fast instead of hanging on an unreachable API server
kubectl --request-timeout=30s get nodes
```

> Always set `--request-timeout` in CI. Without it an unreachable API server hangs until the job times out, which turns a thirty-second failure into a twenty-minute one.

## FAQ

### flux create kustomization: Apply from a Source?

A Kustomization is Flux's apply loop: it takes a path inside a source and continuously applies it to the cluster.

### What it does?

flux create kustomization defines a Kustomization custom resource that references a --source (a GitRepository or OCIRepository), applies the manifests under --path, and reconciles on --interval. --prune deletes resources removed from the source.

### In CI?

Set --prune=true so deletions in Git propagate to the cluster. --wait=true makes the Kustomization report Ready only when its workloads are healthy, which combined with flux reconcile gives a synchronous deploy you can gate on.

### Common errors in CI?

"✗ Kustomization reconciliation failed: kustomize build failed: ... no such file or directory" means --path is wrong. "dry-run failed: ... is forbidden" means RBAC denies the service account that field. "✗ source not found" means the --source kind/name does not match an existing source object.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
