Kustomize is a declarative Kubernetes configuration tool that manages existing YAML manifests without templating. It is integrated into kubectl, supports reusable bases and environment-specific overlays, and helps keep configurations DRY. section 5.3 section 5.3.2
Use Kustomize to organize and apply Kubernetes configurations:
- Create a base directory containing resource manifests such as a Deployment and Service. section 5.3.2
- Add kustomization.yaml and list the resources it manages. section 5.3.2
- Apply the base with kubectl apply -k base/. section 5.3.2
- Verify the resulting resources with kubectl get deploy,svc. section 5.3.2
- Create overlays that modify the base for staging, production, or development without duplicating the underlying YAML. section 5.3.2
Staging overlay with three replicas
A staging kustomization can reference ../../base and apply a patch targeting Deployment my-app. A JSON patch replaces /spec/replicas with 3, changing the environment-specific desired state while preserving the shared base.
