Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

09 — Base values + per-env overrides (dev / staging / prod)

Note — different shape than other examples. Every other folder under docs/02-examples/ ships a single values.yaml and follows the fixed NN-name/{values.yaml,argocd/,flux/,helm/} layout. This example deliberately departs from that — there is no values.yaml. Tooling that iterates docs/02-examples/*/values.yaml will skip this folder, which is intentional. Use values-base.yaml together with one of the values-<env>.yaml overlays.

One chart, one app — three environments. The values are split into a values-base.yaml carrying the invariant configuration and three thin values-<env>.yaml overlays that adjust replica counts, resource sizing, image tags and a few env vars.

This shows how the chart’s keyed-map structure (ADR 002) and global.env cascade (ADR 003) make per-environment overlays minimal — typically 10-20 lines each.

Files (different shape than other examples)

FilePurpose
values-base.yamlCommon configuration applied to every environment.
values-dev.yamlDev overrides: 1 replica, smaller resources, dev image tag.
values-staging.yamlStaging overrides: 2 replicas, prod-ish sizing, staging hostname.
values-prod.yamlProd overrides: HPA on, real resources, real hostname, monitoring on.
argocd/application-prod.yamlArgo CD Application for prod, multi-source: chart + base + prod overlay.
argocd/applicationset.yamlOne Argo CD ApplicationSet rendering one Application per environment from a list generator.
flux/ocirepository.yamlFlux OCIRepository.
flux/helmrelease-prod.yamlFlux HelmRelease for prod, with valuesFrom referencing a ConfigMap + inline overlay.
helm/install-dev.shPlain helm upgrade --install for dev (-f values-base.yaml -f values-dev.yaml).

What this shows

  • Two-file values pattern: pass values-base.yaml and values-<env>.yaml to Helm via repeated -f. Later files win on key collision.
  • Per-env fullnameOverride: each overlay pins its own resource-name prefix (orders-dev / orders-staging / orders-prod), so the prod Ingress backend can name orders-prod-api without depending on the release name Argo CD or Flux passes.
  • Argo CD multi-source with multiple valueFiles: the chart source lists both files; Argo CD merges them in order before running Helm.
  • Argo CD ApplicationSet: a list generator declares the envs once; the template stamps out an Application per env. Avoids hand-maintaining three near-identical Application CRs.
  • Flux valuesFrom: prod values can also live in a ConfigMap (managed separately) — useful when ops change values out-of-band of git.

Try it (dev only — adjust for other envs)

# Helm
bash helm/install-dev.sh

# Argo CD (prod)
kubectl apply -f argocd/application-prod.yaml -n argocd

# Argo CD (all three envs at once)
kubectl apply -f argocd/applicationset.yaml -n argocd

# Flux (prod)
kubectl apply -f flux/