Kustomize Overlays
base/ holds a Deployment and a Service. Production needs 5 replicas and the image tag 2.4.1, without copying the base manifests. What is the Kustomize way?
base/
2.4.1
Choose one answer
Create overlays/prod/kustomization.yaml with resources: [../../base], plus replicas and images entries (or a patch), then run kubectl apply -k overlays/prod.
overlays/prod/kustomization.yaml
resources: [../../base]
replicas
images
kubectl apply -k overlays/prod
Put a values.yaml file with replicas: 5 in overlays/prod/ and run kubectl apply -f overlays/prod.
values.yaml
replicas: 5
overlays/prod/
kubectl apply -f overlays/prod
Edit base/deployment.yaml and keep a separate git branch for production.
base/deployment.yaml
Run kubectl kustomize base --set replicas=5,image=2.4.1 | kubectl apply -f -.
kubectl kustomize base --set replicas=5,image=2.4.1 | kubectl apply -f -