How do you structure values files for multiple environments?
IntermediateConceptValues & Precedence
Answer
Keep chart defaults in values.yaml safe and environment-agnostic, then layer small override files:
shop/values.yaml # defaults (in the chart)
deploy/values-common.yaml # org-wide settings
deploy/values-dev.yaml # 1 replica, debug logging, no persistence
deploy/values-prod.yaml # 3 replicas, HPA, PDB, ingress TLS, persistence
deploy/secrets.prod.yaml # SOPS-encrypted
helm upgrade --install shop oci://.../shop --version 1.4.0 \
-f deploy/values-common.yaml -f deploy/values-prod.yaml -f secrets://deploy/secrets.prod.yaml
Diff the env files periodically; drift between them is where "works in staging" bugs come from.
More on Values & Precedence
What is the precedence order of values in Helm?BeginnerHow are lists merged across values files?IntermediateWhat is the difference between `--set` and `--set-string`?BeginnerHow do you set nested keys, list items and keys containing dots with `--set`?IntermediateWhat are `--set-file`, `--set-json` and `--set-literal` for?IntermediateHow do you remove a default value set in a chart's `values.yaml`?Intermediate