- Defining a clear directory layout
- Deploying resources manually with
kubectl - Introducing Kustomize for centralized and per-directory customization
Directory Layout
Under thek8s/ 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: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 rootkustomization.yaml under k8s/:
kubectl’s built-in Kustomize support:
You can apply overlays without installing the standalone Kustomize binary by running:See [Kubectl apply documentation].
Per-Directory Kustomization
For better modularity, place akustomization.yaml in each subfolder.
api/kustomization.yaml
cache/kustomization.yaml
db/kustomization.yaml
kustomization.yaml to reference directories: