Most Helm charts start with one values.yaml and grow a copy per environment. A few months later nobody knows which copy is the truth. Here is a layout that stays small.
The layout
chart/
values.yaml # defaults shared by every environment
values-dev.yaml # only what differs in dev
values-prod.yaml # only what differs in prod
Base values
replicaCount: 2
image:
repository: myregistry.azurecr.io/api
tag: "1.0.0"
resources:
requests: { cpu: 100m, memory: 128Mi }
limits: { cpu: 500m, memory: 256Mi }
Per-environment overrides
# values-prod.yaml
replicaCount: 4
resources:
limits: { cpu: "1", memory: 512Mi }
Deploy with the base first and the override last. Later files win:
helm upgrade --install api ./chart \
-f chart/values.yaml \
-f chart/values-prod.yaml \
--namespace api --atomic
Why it works
| Concern | One file per env | Base + overrides |
|---|---|---|
| Diff between envs | Hard | Read the override file |
| Adding a new default | Edit every file | Edit one file |
| Review size | Large | Small |
Rule of thumb: if an override file grows past a screen, something belongs in the base.
Checklist
- Keep secrets out of values files; use Key Vault or sealed secrets.
- Pin
image.tag, neverlatest. - Run
helm templatein CI and diff the output.
Top comments (0)