Kustomize Build Failed: Fix Render Before Apply
When kustomize build fails, the cluster is not the problem — your overlay composition is. Reproduce the render locally first.
CI stops with:
kustomize build overlays/prodError: trouble configuring builtin PatchStrategicMergeTransformer:
no matches for Id Deployment.v1.apps/web[noNs]No pod was harmed. No namespace was touched. The failure is entirely in Git.
That distinction matters: kubectl apply cannot fix a render error.
Build output is the source of truth
Kustomize merges bases, overlays, patches, and generators into a single manifest stream. If kustomize build fails:
- The patch target name/kind/apiVersion does not match the base resource
- Two resources with the same GVK+name+namespace are merged twice
- A remote base ref or component path is wrong
kustomize build overlays/prod
# fix until clean
kubectl diff -k overlays/prod # optional: compare render to liveArgo CD ComparisonError and CI failures often show the same stack trace — fix render outside the cluster first.
Common overlay mistakes
Patch typo — strategic merge patches require exact resource identity. web vs web-app fails at build time, not apply time.
images field mismatch — images.name must match the container image repository string without tag. A typo leaves the old tag in rendered output.
ConfigMap hash suffixes — configMapGenerator changes pod template refs intentionally. Unexpected rollouts after a ConfigMap edit are often expected behavior.
Duplicate resources — listing the same base twice or overlapping resources entries produces duplicate Deployments in build output.
What not to do first
kubectl apply -kwith--validate=falseon a broken overlay- Patch live objects instead of fixing
kustomization.yaml - Delete generator blocks without understanding rollout impact
Train the reflex
The Kustomize Overlays path uses scenario cards for build failures, image tag drift, duplicate resources, and live drift — pick the best next diagnostic step under pressure.
Part of the Platform & Policy Pack: Helm, Kustomize, Kyverno, and Argo CD in one purchase.