Interview Prep/Helm/Values & Precedence

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.

All Helm questions Roadmap: Helm

More on Values & Precedence