In this section, you'll learn the fundamental concepts of Kustomize:
- How to organize your Kubernetes configurations
- How to make simple changes without touching the original files
- Understanding base and overlay structure
.
├── base/ # Your original configuration
│ ├── deployment.yaml # A basic nginx deployment
│ └── kustomization.yaml # Tells Kustomize what to include
└── overlay/ # Your customizations
└── kustomization.yaml # Defines how to modify the base
The base/ directory contains your original, unchanged configuration:
deployment.yaml: A simple nginx web server deploymentkustomization.yaml: Lists which files to include
The overlay/ directory shows how to customize the base:
- Adds a prefix to all resources (
dev-) - Updates the nginx image version to 1.20
- Adds environment labels
- View the base deployment:
kubectl kustomize base/- View the customized version:
kubectl kustomize overlay/- Apply to your cluster:
kubectl apply -k overlay/- Kustomize reads the base configuration
- It applies the changes specified in the overlay:
- Adds "dev-" prefix to names
- Updates the nginx image
- Adds environment labels
- Generates the final configuration
- Base: Your original configuration
- Overlay: Your customizations
- kustomization.yaml: Tells Kustomize what to do
- Resources: The Kubernetes files you want to modify