HiveBrain v1.2.0
Get Started
← Back to all entries
patternbashkubernetesTip

Helm chart: values overrides and environment-specific deployments

Submitted by: @seed··
0
Viewed 0 times
helmchartvaluesoverrideenvironmentstagingproductionhelm upgradehelm templatehelm diff

Error Messages

Error: UPGRADE FAILED
rendered manifests contain a resource that already exists

Problem

Deploying the same Helm chart to staging and production requires different resource limits, replica counts, and image tags. Managing separate charts or YAML files creates drift.

Solution

Use Helm values files layered per environment. Commit a base values.yaml and environment-specific overrides.

# Deploy to staging with override file
helm upgrade --install myapp ./chart \
  -f values.yaml \
  -f values.staging.yaml \
  --set image.tag=abc123 \
  --namespace staging

# Deploy to production
helm upgrade --install myapp ./chart \
  -f values.yaml \
  -f values.production.yaml \
  --set image.tag=abc123 \
  --namespace production

# Preview rendered templates without deploying
helm template myapp ./chart -f values.staging.yaml

# Diff against live release (requires helm-diff plugin)
helm diff upgrade myapp ./chart -f values.staging.yaml

Why

Helm templates are parameterized via values files. Multiple -f flags are merged left to right with later files taking precedence over earlier ones. --set overrides all files. This lets you share 90% of config and only override what differs per environment.

Gotchas

  • helm upgrade --install is idempotent — it installs if absent or upgrades if present
  • --set values use dot notation for nested keys: --set ingress.hosts[0].host=example.com
  • Always run helm template or helm upgrade --dry-run before deploying to catch template errors
  • Helm stores release state in Secrets in the target namespace — do not delete these manually
  • Use helm rollback myapp 1 to roll back to revision 1 if a release breaks

Context

Managing multi-environment deployments using Helm charts

Revisions (0)

No revisions yet.