Kubernetes kustomize command giving error when we specify base manifest files in kustomization.yaml file under resources section
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Kustomize errors under the resources section are usually caused by path issues, invalid directory layout, or mixing old and new syntax patterns. The error message can look vague, but the failure is often deterministic once you inspect file structure carefully. This guide provides a repeatable debug workflow and a clean base-overlay setup.
Core Topic Sections
Understand what resources expects
In modern Kustomize, resources should point to files or directories that resolve to valid Kubernetes manifests. If a directory is listed, that directory should itself contain a valid kustomization.yaml.
Typical valid examples:
resources: ["deployment.yaml", "service.yaml"]resources: ["../base"]where../basecontains its ownkustomization.yaml
Typical invalid examples:
- Wrong relative path from current
kustomization.yamllocation. - Directory listed without a nested
kustomization.yaml. - Typo in file extension or file name.
Use a known-good base and overlay layout
A predictable directory tree prevents most path mistakes:
base/kustomization.yaml:
overlays/dev/kustomization.yaml:
Build command:
Or with kubectl integration:
Debug path and file resolution quickly
When kustomize build fails, verify each path from the perspective of the file being executed, not your shell location assumption.
Useful checks:
Then validate individual manifests:
If single manifests are valid but Kustomize fails, the issue is almost always path resolution or Kustomization syntax.
Watch for deprecated patterns
Older docs may mention bases. Current Kustomize uses resources. Mixing versions across local binaries and CI can cause confusing errors.
Recommended checks:
Pin tool versions in CI and local dev containers to avoid environment-specific behavior.
Handle symlinks and remote paths carefully
Symlinked directories or remote references can behave differently depending on security flags and tool versions. If you suspect path traversal restrictions:
- Replace symlink with real path temporarily.
- Build with standalone
kustomizeand withkubectl kustomize. - Compare outputs and errors.
Use the simpler path first, then reintroduce indirection only if needed.
Keep overlays minimal and explicit
Overlays should declare only environment-specific differences. Avoid copying full base resources into overlays. Smaller overlays make path errors obvious and reduce merge conflicts.
Good overlay content usually includes:
- Base reference in
resources. - Patches for changed fields.
- Optional name suffix and labels.
This keeps configuration readable and easier to review.
Verification before apply
Treat Kustomize output as build artifact. Always inspect generated manifests before cluster apply in production pipelines.
This catches schema or reference issues early and protects cluster reliability.
Common Pitfalls
- Using relative paths that are correct from shell location but wrong from Kustomization file location.
- Listing a directory in
resourcesthat does not contain a validkustomization.yaml. - Mixing deprecated
basesusage with current tool expectations. - Relying on different local and CI Kustomize versions.
- Applying directly without validating generated output first.
Summary
- Most
resourceserrors are path or structure problems, not Kubernetes API issues. - Use a clear base-overlay layout where every referenced directory has a Kustomization file.
- Validate manifests and tool versions to isolate version-related confusion.
- Keep overlays small and explicit to reduce path mistakes.
- Build and dry-run generated YAML before deployment.

