Skip to main content
Organizing and scaling your Kubernetes manifests becomes much simpler when you adopt a consistent directory structure and leverage Kustomize. In this guide, we’ll walk through:
  • Defining a clear directory layout
  • Deploying resources manually with kubectl
  • Introducing Kustomize for centralized and per-directory customization

Directory Layout

Under the k8s/ folder, structure your manifests by component:
Each subfolder contains the YAML files for its service.

Sample Manifests

Database Deployment (db/db-depl.yaml)

Redis Service (cache/redis-service.yaml)

Redis Credentials (cache/redis-config.yaml)


Manual Deployment

Apply each directory in sequence:
Or chain them:
Make sure your kubectl context is pointed to the correct cluster and you have permission to create resources.

Cleaning Up


Introducing Kustomize

Kustomize lets you define and compose resources without template syntax. Start by creating a root kustomization.yaml under k8s/:
Generate the merged manifest:
Apply directly to the cluster:
Or use kubectl’s built-in Kustomize support:
You can apply overlays without installing the standalone Kustomize binary by running:
See [Kubectl apply documentation].
Verify your pods:

Per-Directory Kustomization

For better modularity, place a kustomization.yaml in each subfolder.

api/kustomization.yaml

cache/kustomization.yaml

db/kustomization.yaml

Finally, update the root kustomization.yaml to reference directories:
Apply all components in one command:
Confirm everything is running:
This scalable structure keeps your manifests organized and ready for production-grade overlays.

Watch Video

Practice Lab