DEV Community

Nishant Rana
Nishant Rana

Posted on

A Minimal Helm Values Layout for Environments

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
Enter fullscreen mode Exit fullscreen mode

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 }
Enter fullscreen mode Exit fullscreen mode

Per-environment overrides

# values-prod.yaml
replicaCount: 4
resources:
  limits: { cpu: "1", memory: 512Mi }
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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, never latest.
  • Run helm template in CI and diff the output.

Top comments (0)