kustomization.yaml, Kustomize lets you orchestrate Kubernetes manifests across many folders—no extra scripting required.
Flat Directory Structure
When you start small, a single directory often suffices:Introducing Subdirectories
As your manifest count grows, you might split them:Manually running
kubectl apply in each subfolder can be error-prone and difficult to automate in CI/CD.Single Root kustomization.yaml
Instead of listing directories every time, create a singlekustomization.yaml at k8s/:
kubectl apply -k invokes Kustomize natively—you don’t need the standalone binary.When the Resource List Grows
Adding more services (e.g.,cache/, kafka/) quickly makes the root manifest unwieldy:
kustomization.yaml is hard to maintain.
Nested kustomization.yaml Files
A cleaner pattern is to give each subdirectory its ownkustomization.yaml:
k8s/api/kustomization.yaml
k8s/db/kustomization.yaml
cache/ and kafka/. Then simplify your root kustomization.yaml:
Command Reference
| Layout | Command |
|---|---|
| Flat folder | kubectl apply -f k8s/ |
| Single-root Kustomization | kubectl apply -k k8s/ |
| Build then apply | kustomize build k8s/ | kubectl apply -f - |