Skip to content
Latchkey

Flux Kustomization "kustomize build failed" in CI

kustomize-controller ran kustomize build on the path and it failed. A resource listed in kustomization.yaml is missing, a patch target does not exist, or the YAML is invalid, so no manifest set could be produced.

What this error means

A Kustomization reports "False" with "kustomize build failed" often followed by "accumulating resources" and the file it could not read or parse.

kustomize-controller
kustomize build failed: accumulating resources: accumulation err='accumulating resources from 'deployment.yaml': evalsymlink failure ...': must build at directory: not a valid directory: evalsymlink failure

Common causes

A resource listed in kustomization.yaml is missing

The resources: list names a file or directory that does not exist at the built path, so accumulation fails before any output.

An invalid patch or malformed YAML

A patch targets a resource that is not present, or a manifest has a syntax error, so kustomize cannot build the overlay.

How to fix it

Build the overlay locally to find the bad file

  1. Run kustomize build on the same path CI uses to reproduce the error.
  2. Fix the missing resource path or the invalid patch target.
  3. Commit and reconcile the Kustomization.
Terminal
kustomize build ./clusters/prod
flux reconcile kustomization apps --with-source

Confirm spec.path points at the overlay

Make sure spec.path in the Kustomization points at the directory that contains a valid kustomization.yaml.

Terminal
kubectl -n flux-system describe kustomization apps

How to prevent it

  • Run kustomize build in CI before merging so build errors surface early.
  • Keep resources: entries in sync with the files in the directory.
  • Validate patch targets exist in the base before adding overlays.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →