Kustomize is a Kubernetes-native configuration management tool that offers a template-free way to customize and manage application configurations for Kubernetes deployments. It operates directly on plain YAML manifests, enabling you to create variations of your base configurations (overlays) without altering the original files.
1. **Base Configuration (deployment.yaml):**
```yaml apiVersion: apps/v1 kind: Deployment metadata:
name: my-appspec:
replicas: 3 template: spec: containers: - name: my-app image: my-org/my-app:latest```
2. **Overlay for Production Environment (production/kustomization.yaml):**
```yaml apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - ../base/deployment.yaml patchesStrategicMerge: - deployment-patch.yaml ```
3. **Patch File (production/deployment-patch.yaml):**
```yaml apiVersion: apps/v1 kind: Deployment metadata:
name: my-appspec:
replicas: 5```
In this example, the base configuration defines a Deployment with 3 replicas. The production overlay applies a patch that increases the replica count to 5 for the production environment.