Custom Values Files (-f)

Pass one or more YAML files with -f to override chart defaults; later files win over earlier ones.

Syntaxhelm install <name> <chart> -f values-prod.yaml

For anything more than a couple of overrides, keep your settings in a YAML file and pass it with -f (or --values). This is the standard way to manage per-environment configuration.

Layering files

You can pass -f multiple times. Files are merged in order, and later files override earlier ones. A common pattern is a shared base plus an environment overlay.

helm upgrade app ./chart -f base.yaml -f prod.yaml

Only what changes

An override file needs to contain only the keys you are changing. Everything else falls back to the chart's values.yaml.

Example

Example · yaml
# values-prod.yaml — only the overrides for production
replicaCount: 5

image:
  tag: "1.26"

service:
  type: LoadBalancer

resources:
  limits:
    cpu: 500m
    memory: 512Mi

When to use it

  • An operator maintains a values-prod.yaml file in the app's Git repository with production-specific settings, applying it with -f on every helm upgrade.
  • A platform team passes two values files on install: the chart's shared defaults file first, then an environment-specific override file that wins on conflicts.
  • A developer creates a local values-local.yaml excluded from version control to hold developer-only overrides like debug flags and local service endpoints.

More examples

Install with a values file

Applies all settings from values-prod.yaml on top of chart defaults during installation.

Example · bash
helm install my-app ./my-chart \
  -f values-prod.yaml \
  -n production

Layer multiple values files

Layers three files in order; later files override earlier ones for any duplicate keys, enabling a base + environment + secrets pattern.

Example · bash
helm upgrade --install my-app ./my-chart \
  -f values.yaml \
  -f values-prod.yaml \
  -f values-secrets.yaml \
  -n production

Environment-specific file example

Shows a minimal environment values file that overrides only production-specific settings, keeping it focused and easy to review.

Example · yaml
# values-prod.yaml — only production overrides
replicaCount: 5
image:
  tag: v2.1.0
resources:
  limits:
    cpu: 2
    memory: 1Gi
ingress:
  enabled: true
  host: app.example.com

Discussion

  • Be the first to comment on this lesson.