Skip to content
Français
Sync not enabled: your progress stays in this browser My learning
Select theme
Français

Helm values: customize cleanly with -f and --set

By updated

Improve this page

Logo Helm

This guide teaches you to customize your Helm deployments without modifying the charts. You will write values.yaml files to manage several environments, understand the order of precedence of overrides and avoid the traps of --set. In 20 minutes, you will know how to configure a chart in a reproducible way.

What you will learn

  • Read the default values of a chart with helm show values
  • Override a value on the command line with --set, --set-string and --set-json
  • Structure values-<env>.yaml files for dev, staging and production
  • Apply the order of precedence between defaults, -f files and --set
  • Keep the existing values during a helm upgrade
  • Check the result with helm get values and helm template

Prerequisites

The examples use the podinfo/podinfo chart: add its repository with helm repo add podinfo https://stefanprodan.github.io/podinfo. The commands pin the chart version with --version 6.14.1, so that the keys cited stay the ones you read.

Understanding the values system

Values are the normal way to adapt a chart without modifying it, and that is what makes a chart reusable from one team to another. The mechanism comes down to three steps: the defaults carried by the chart, your overrides, and a merge whose order decides who wins. This section covers all three.

How does customization work?

Every Helm chart contains a values.yaml that carries default values. At installation, Helm merges your overrides with those defaults, then injects the result into the templates to generate the Kubernetes manifests.

Merging Helm values: the default values.yaml of the chart plus your overrides (-f, --set) give the final values, injected into the templates to generate the Kubernetes manifests.values.yamlchart defaultsYour overrides-f, --setFinal valuesmerged +  + Templates*.yamlK8s manifestsgenerated
Source · SVG
Esc to close, + and − to zoom, scroll to move around. 100 %

How do you see the default values of a chart?

A chart only exposes the parameters its author decided to make configurable. Overriding a key that is absent from values.yaml produces no error: Helm adds it to the values tree, and the template ignores it. A typo, for example journl instead of journal, creates a key the chart does not know and therefore falls into this case. It is a very common cause of "my override does nothing".

Only a values.schema.json file that declares additionalProperties: false changes this: the same typo is then rejected (additional properties 'journl' not allowed). In every case, start by reading the available values:

Terminal window
helm show values podinfo/podinfo --version 6.14.1

The command prints the values.yaml of the chart, comments included. Spot the keys this lesson overrides: replicaCount, logLevel, image (with repository, tag and pullPolicy), ui (with color and message), service and resources. For each one, note the nesting level and the default value, since every override starts from that value.

What you need to spot:

ElementMeaning
Hierarchical structureui.color means ui: → color:
Empty values ("", {}, [])To fill in if needed
Commented valuesOptions that are available but disabled
Data typesNumbers (1), strings ("info"), booleans (true), objects, lists

Overriding with --set (quick but limited)

The --set option changes a value directly on the command line, without creating a file. It is handy when exploring, but the override then exists only in your shell history: it is neither versioned nor readable by a colleague, and it disappears on the next helm upgrade that passes other values without repeating it. Keep it for experiments, and switch to -f as soon as the value must survive.

Terminal window
helm install demo podinfo/podinfo --version 6.14.1 \
--namespace helm-demo \
--create-namespace \
--set replicaCount=2 \
--set ui.message="Hello DevOps"

The output is that of an ordinary installation: NAME is demo, STATUS is deployed and REVISION is 1. It does not say which values were taken into account, that is the subject of the next section.

Checking the values used

Helm stores the values in the release secret, not in a file on your workstation: you can therefore read them back from another machine, as long as you have access to the namespace. By default, helm get values shows only the overrides, which answers the question "what did someone change here":

Terminal window
helm get values demo -n helm-demo

Expected result:

USER-SUPPLIED VALUES:
replicaCount: 2
ui:
message: Hello DevOps

To see all the values (defaults + merged overrides):

Terminal window
helm get values demo -n helm-demo --all

The output starts with COMPUTED VALUES:. You find your two overrides there, replicaCount: 2 and ui.message: Hello DevOps, mixed with the chart defaults that you did not supply, for example ui.color, logLevel or the image block.

Reading the result:

SectionContent
USER-SUPPLIED VALUESOnly your overrides
COMPUTED VALUESComplete merge (defaults + overrides)

--set syntax for different types

The --set syntax has its own grammar, which is neither YAML nor JSON. Two characters are significant in it and will trip you up sooner or later: the comma separates two assignments, the dot goes down one level. In a value, only the comma splits: it is written \,, whereas dots pass through as they are (node-role.kubernetes.io/control-plane in the example below). In a key, it is the dot that counts: if the key name itself contains a dot, like an annotation example.com/name, it is written \., otherwise Helm goes down one level. Bracketed indexes are used to write into a list.

TypeSyntaxExample
Simple value--set key=value--set replicaCount=3
Nested value--set parent.child=value--set ui.color="#ff0000"
List--set key[0]=val1,key[1]=val2--set backends[0]=http://a:80
Object in a list--set list[0].key=value--set tolerations[0].key=node

Example with a list (tolerations):

Terminal window
helm template test podinfo/podinfo --version 6.14.1 \
--set "tolerations[0].key=node-role.kubernetes.io/control-plane" \
--set "tolerations[0].effect=NoSchedule"

In the Deployment manifest, under the spec of the Pod, the tolerations key must contain one entry that carries the key node-role.kubernetes.io/control-plane and the effect NoSchedule. The two assignments that share the [0] index were grouped into a single object.

--set-string: forcing the string type

By default, --set converts the type of what it receives: true and false become booleans, null becomes null, and an integer such as 123 becomes a number. A decimal value such as 1.0, or a number that starts with 0 such as 007, is not converted and stays a string.

If you need a literal string for a value made of digits, use --set-string:

Terminal window
# --set reads 123 as an integer
helm template test podinfo/podinfo --version 6.14.1 --set image.tag=123
# --set-string forces the string "123"
helm template test podinfo/podinfo --version 6.14.1 --set-string image.tag="123"

Depending on the template, both commands can render the same text: a template that copies the value into a string does not show the difference. The type is read in helm get values of an installed release, which shows tag: 123 for an integer and tag: "123" for a string. It matters as soon as a template compares or quotes the value, or the values.schema.json of the chart requires a string.

An image tag made of digits only, such as 2 or 123, is read by --set as an integer. This is a classic trap: a chart whose template writes the value as is then renders tag: 2 instead of tag: "2", and a schema that requires a string rejects the value. Use --set-string for these tags:

Terminal window
--set-string image.tag="2"

Decimals such as 1.0 stay strings with --set. The decimal trap is found in a file passed with -f: YAML reads tag: 1.10 as the number 1.1 and loses the trailing zero. Put the value in quotes in the file:

image:
tag: "1.10"

--set-json: complex structures

Writing a complete resources block with --set takes four assignments and as many chances to get the level wrong. The --set-json option accepts an entire JSON value, which preserves the structure and the types, empty lists and nested objects included, which the dotted syntax handles poorly:

Terminal window
helm template test podinfo/podinfo --version 6.14.1 \
--set-json 'resources={"limits":{"cpu":"500m","memory":"256Mi"},"requests":{"cpu":"100m","memory":"128Mi"}}'

In the Deployment manifest, the resources block of the container must carry the limits (500m of CPU, 256Mi of memory) and the requests (100m, 128Mi) that you passed as JSON.

Overriding with -f (values file)

A values file is an ordinary YAML file whose tree reproduces that of the values.yaml of the chart. It does not need to be complete: Helm merges it with the defaults, key by key, and replaces only what you declare. That merge is what lets you keep files short, limited to the differences.

values-dev.yaml
# Configuration for the development environment
replicaCount: 1
ui:
color: "#17a2b8" # Cyan blue to identify dev
message: "DEV environment"
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 10m
memory: 32Mi
logLevel: debug

Use it with -f (or --values):

Terminal window
helm install demo-dev podinfo/podinfo --version 6.14.1 \
--namespace helm-demo \
--create-namespace \
-f values-dev.yaml

Checking the values applied

Compare what helm get values returns with the content of your values-dev.yaml: the two must match key for key. A missing file does not go unnoticed: helm install stops with Error: INSTALLATION FAILED: open values-dev.yaml: no such file or directory and deploys nothing. The message ends with no such file or directory, and the name of the missing file comes before it (open fichier-absent.yaml: no such file or directory). A difference between the two outputs therefore comes from elsewhere, for example from a file passed further along the line that overwrites the value.

A misspelled or wrongly nested key does not show up this way: helm get values shows it as you wrote it, since Helm adds it to the values tree even if the template does not read it. To find it, compare your keys with the ones the chart knows with helm show values, then run helm template: the value you thought you passed does not appear in the rendering.

Terminal window
helm get values demo-dev -n helm-demo

Expected result:

USER-SUPPLIED VALUES:
logLevel: debug
replicaCount: 1
resources:
limits:
cpu: 100m
memory: 64Mi
requests:
cpu: 10m
memory: 32Mi
ui:
color: '#17a2b8'
message: DEV environment

Managing several environments

The same chart must serve staging and production, without being duplicated. This is where the maintainability of a deployment is decided: as soon as you copy a chart to change two values, the two copies diverge and nobody knows which one is authoritative. The strategies that follow keep a single chart and vary the values files.

File strategy per environment

A common strategy separates what is shared from what varies. A values-base.yaml file carries the settings that are identical everywhere, image, ports and probes, and each environment writes only its differences. This avoids the silent drift where a security setting present in staging is missing in production, for lack of having edited both files together.

  • Répertoirehelm-config/
    • values-base.yaml Common configuration
    • values-dev.yaml Development overrides
    • values-staging.yaml
    • values-prod.yaml Production overrides

values-base.yaml (common configuration):

image:
repository: ghcr.io/stefanprodan/podinfo
pullPolicy: IfNotPresent
service:
type: ClusterIP
httpPort: 9898
probes:
readiness:
initialDelaySeconds: 1
liveness:
initialDelaySeconds: 1

values-prod.yaml (production overrides):

replicaCount: 3
ui:
color: "#28a745" # Green to identify prod
message: "Production"
resources:
limits:
cpu: 500m
memory: 256Mi
requests:
cpu: 100m
memory: 128Mi
logLevel: warn

Combining several -f files

You can pass several files with -f on the same command. Helm merges them from left to right, and for a key present in two files, the value of the last file on the line wins. The order of the -f options therefore carries meaning: the base file first, the environment next, guarantees that the environment wins.

Terminal window
helm install myapp-prod podinfo/podinfo --version 6.14.1 \
-n production \
--create-namespace \
-f values-base.yaml \
-f values-prod.yaml

When a key appears in several files, the value of the last file wins:

Terminal window
# Demonstration of the order of precedence
# values-a.yaml contains replicaCount: 2
# values-b.yaml contains replicaCount: 5
# File A then B → replicaCount = 5
helm template test podinfo/podinfo --version 6.14.1 -f values-a.yaml -f values-b.yaml
# File B then A → replicaCount = 2
helm template test podinfo/podinfo --version 6.14.1 -f values-b.yaml -f values-a.yaml

Full order of precedence

Helm applies the values in this order (from lowest to highest priority):

1. values.yaml of the chart (default)
↓
2. -f files in order (the last one wins)
↓
3. --set / --set-string / --set-json (highest priority)

Concrete example:

Terminal window
# The chart has replicaCount: 1 by default
# values-prod.yaml has replicaCount: 3
# --set sets replicaCount=5
helm template demo podinfo/podinfo --version 6.14.1 \
-f values-prod.yaml \
--set replicaCount=5
# Result: replicas: 5 in the Deployment (--set wins)

Behavior during upgrades

An upgrade that receives values does not start from what you supplied the previous time, and this is a classic cause of incidents with values. Three flags let you choose what serves as the starting point; understanding them avoids losing a whole configuration on a simple image update.

--reuse-values: keeping the existing values

The default behavior of helm upgrade often surprises: without --reuse-values, an upgrade that passes a single --set starts again from the chart's default values and loses all the overrides of the previous installation (the trap is detailed below). The --reuse-values flag keeps what you had supplied: it starts from the values of the last release and applies your --set only on top.

Terminal window
# Installation (or replacement of the demo release) with several values
helm upgrade --install demo podinfo/podinfo --version 6.14.1 -n helm-demo \
-f values-dev.yaml
# Upgrade keeping the old values + adding a new one
helm upgrade demo podinfo/podinfo --version 6.14.1 -n helm-demo \
--reuse-values \
--set replicaCount=3

Before the upgrade (excerpt of helm get values):

logLevel: debug
replicaCount: 1
ui:
color: '#17a2b8'

After the upgrade with --reuse-values:

logLevel: debug # ← Kept
replicaCount: 3 # ← Changed by --set
ui:
color: '#17a2b8' # ← Kept

--reuse-values has a limit when you upgrade the chart to a new version. It takes the values of the last release as they are, default values of the old chart included, and does not replace them with those of the new chart. The keys that the new version introduces therefore do not get their default, and the keys whose default the new version changed keep the old one. With Helm 4.3.2, a podinfo release upgraded to 6.17.0 with --reuse-values does not apply the defaults of the new spiffe.backendMTLS and spiffe.backendIDs keys.

The podinfo chart gives a concrete example. Its published values.yaml files set image.tag to the chart version: 6.16.0 in chart 6.16.0, 6.17.0 in chart 6.17.0. An upgrade from 6.16.0 to 6.17.0 with --reuse-values therefore keeps image.tag: 6.16.0: tested with Helm 4.3.2, the release shows chart podinfo-6.17.0 while its Pods still run podinfo:6.16.0, and --reset-then-reuse-values does move the image to 6.17.0.

For a version upgrade, export the values you supplied, then pass them again with -f. The file states the desired end state, and Helm starts from the defaults of the new chart before applying your settings.

Terminal window
helm get values demo -n helm-demo -o yaml > reprise.yaml
helm upgrade demo podinfo/podinfo --version 6.17.0 -n helm-demo -f reprise.yaml

Without --all, helm get values returns only the values you supplied, which is exactly what you need to pass again: read reprise.yaml before the upgrade. Helm also offers --reset-then-reuse-values. According to helm upgrade --help, it resets the values to those built into the chart, applies the values of the last release, then merges your --set and -f overrides. It therefore applies the new defaults of the chart, which --reuse-values does not. If --reset-values or --reuse-values is also given, it is ignored.

--reset-values: starting from scratch

To ignore the old values and start again from the default values:

Terminal window
helm upgrade demo podinfo/podinfo --version 6.14.1 -n helm-demo \
--reset-values \
--set ui.message="Fresh start"

After the upgrade with --reset-values:

ui:
message: Fresh start # ← Only override, everything else = default

The partial override trap

As soon as a value is passed, Helm starts again from the chart defaults, unless you add --reuse-values. Only an upgrade with no value at all, neither -f nor --set, takes the old values of the release. This is a classic cause of regression in production, hard to trace back to its cause.

A second, related oversight concerns the chart version: a helm upgrade run without --version takes the latest published version of the chart, not that of the current release. Tested with Helm 4.3.2: a podinfo release installed at 6.16.0, then updated with --set replicaCount=2 and without --version, moved to 6.17.0. That is why the examples in this lesson pin --version.

Terminal window
# ❌ loses the old values
helm upgrade demo podinfo/podinfo --version 6.14.1 -n helm-demo --set newValue=xyz
# OK: keeps the old values
helm upgrade demo podinfo/podinfo --version 6.14.1 -n helm-demo --reuse-values --set newValue=xyz

The most treacherous part is not the loss, it is that it produces no error. A release launched with replicaCount: 2, then updated by a simple --set ui.color=blue, sees its USER-SUPPLIED VALUES reduced to that color alone: replicaCount falls back to the chart's default value, and the Deployment goes from two replicas to one. Nobody is warned, the command returns deployed, and the capacity has been halved.

The reflex that protects you comes down to one command, run before and after every upgrade:

Terminal window
helm get values demo -n helm-demo

Comparing the two outputs takes five seconds and shows exactly what the upgrade took away.

Previewing without deploying: helm template

helm template performs the complete rendering of the templates with your values and prints the resulting manifests, without contacting the cluster. It is the reference tool to check an override before deploying it: you see exactly the YAML that Kubernetes will receive.

Its limit is that it does not read the cluster: it sees neither the available APIs, nor lookup, nor the existing resources, which --dry-run=server can read. But neither of them sends the objects to the Kubernetes API (Helm 4.3.2): the schema, admission and quotas are not checked at this stage. Give helm template exactly the same -f and --set as the command you are targeting: a single difference makes the preview misleading.

Terminal window
helm template demo podinfo/podinfo --version 6.14.1 \
--set replicaCount=3 \
--set "ui.message=Test Template"

The command writes the manifests to standard output, each preceded by a # Source: comment that indicates the original template. In the one for podinfo/templates/deployment.yaml, the replicas: line must be 3.

It is ideal for:

  • Debugging a configuration before deployment
  • Checking what will be created
  • Generating manifests for GitOps (ArgoCD, Flux)

Guided lab: configuring several environments

You are going to create and test a multi-environment configuration with values files.

This exercise is free-form: you type the commands yourself and compare each result with what is expected, with no automatic check. The lab whose validation reads the state of the cluster is further down, in the "Hands-on practice" section.

The exercise chains six steps that you will replay on a real project: create the files per environment, deploy, check the number of pods, then demonstrate the two precedence rules seen above, the preservation by --reuse-values and the priority of --set over a file. Run it on a disposable cluster, since the manifests only create ephemeral objects in a dedicated namespace.

  1. Create the namespace and the values files

    Terminal window
    kubectl create namespace helm-lab

    Create values-base.yaml:

    image:
    repository: ghcr.io/stefanprodan/podinfo
    pullPolicy: IfNotPresent
    service:
    type: ClusterIP
    httpPort: 9898

    Create values-dev.yaml:

    replicaCount: 1
    ui:
    color: "#17a2b8"
    message: "DEV"
    logLevel: debug
    resources:
    limits:
    cpu: 100m
    memory: 64Mi

    Create values-prod.yaml:

    replicaCount: 3
    ui:
    color: "#28a745"
    message: "PROD"
    logLevel: warn
    resources:
    limits:
    cpu: 500m
    memory: 256Mi
  2. Deploy the dev environment

    Terminal window
    helm install app-dev podinfo/podinfo --version 6.14.1 -n helm-lab \
    -f values-base.yaml \
    -f values-dev.yaml
  3. Check the values and the pods

    Terminal window
    helm get values app-dev -n helm-lab
    kubectl get pods -n helm-lab

    Expected: 1 pod (replicaCount: 1)

  4. Test an upgrade with --reuse-values

    Terminal window
    helm upgrade app-dev podinfo/podinfo --version 6.14.1 -n helm-lab \
    --reuse-values \
    --set ui.message="DEV - Updated"
    helm get values app-dev -n helm-lab

    Check that logLevel: debug is still present.

  5. Test file vs --set precedence

    Terminal window
    helm upgrade app-dev podinfo/podinfo --version 6.14.1 -n helm-lab \
    -f values-base.yaml \
    -f values-dev.yaml \
    --set replicaCount=5
    kubectl get pods -n helm-lab

    Expected: 5 pods (--set overrides the file)

  6. Clean up

    Terminal window
    helm uninstall app-dev -n helm-lab
    kubectl delete namespace helm-lab

At the end, you have seen the two rules at work: --reuse-values keeps the previous overrides, and --set wins over a file.

Best practices

These conventions are not mandatory, and that is precisely the problem: nothing enforces them, but their absence is paid for six months later, when nobody knows any more which values file is applied in production. The three conventions that follow avoid that situation.

Put the environment overrides in a values/ subfolder next to the chart, rather than loose at the root. This convention makes explicit which files are deployment variants, and it simplifies the .gitignore: a single pattern values.override.yaml excludes local overrides without risking forgetting a legitimate environment file.

  • Répertoirecharts/
    • Répertoiremyapp/
      • Chart.yaml
      • values.yaml Sensible defaults
      • Répertoirevalues/ Per-environment overrides
        • dev.yaml
        • staging.yaml
        • prod.yaml

Naming conventions

The name of a values file must tell you at a glance what it overrides and why. Two axes are enough: by environment for what changes between dev, staging and production, by feature for what enables an optional block. The values.override.yaml convention designates a local file that is never versioned: that is where a setting specific to your workstation goes.

ConventionExampleUse
values-<env>.yamlvalues-prod.yamlOne file per environment
values-<feature>.yamlvalues-monitoring.yamlOne file per feature
values.override.yamlLocal overrides (gitignored)

Production values checklist

Go through this list before any production deployment. The first two points are about traceability, finding who changed what, the last three about execution safety: a secret left in clear text in a values file ends up in the Git history, and a deployment without limits or requests exposes the cluster to a pod that monopolizes a node.

  • All the values are versioned in Git.
  • No --set in CI/CD: only -f files.
  • Sensitive values are externalized (Secrets, Vault).
  • The limits and the requests are defined explicitly.
  • At least 2 replicas in production, for high availability.

Troubleshooting

Most values problems come down to two questions: did the value actually reach the template, and does it have the right type? helm get values --all answers the first by showing the actual merge, helm template answers the second by showing the generated YAML. The table pairs each symptom with the right reflex.

SymptomProbable causeSolution
Value not appliedTypo in the path (ui.Color vs ui.color)Check with helm show values
Numeric tag rendered without quotes (tag: 2) while the image expects a string--set converts an integer into a number--set-string; in a -f file, put the value in quotes (tag: "1.10")
Values lost after an upgradeA partial --set or -f, without --reuse-valuesPass all the -f files again, or export the values with helm get values -o yaml and pass them again with -f. For --reuse-values and version upgrades, see the --reuse-values section
YAML parsing errorIncorrect indentationValidate with yamllint
Error: INSTALLATION FAILED: values don't meet the specifications of the schema(s) in the following chart(s):A value does not comply with the values.schema.json of the chartRead the - at '/<key>' line that follows, then fix the value or read the schema of the chart

The complete message takes four lines. The line that matters is the last one: it gives the path of the faulty key and what the schema expected. Here is the result of helm install s ./schema --set replicaCount=deux, with a schema that requires an integer of at least 1 for replicaCount:

Error: INSTALLATION FAILED: values don't meet the specifications of the schema(s) in the following chart(s):
schema:
- at '/replicaCount': got string, want integer

The same message comes out with -f on a file containing replicaCount: "3" (in quotes) and with --set-string replicaCount=3: a string stays a string, even when it looks like a number. With --set replicaCount=0, the last line becomes - at '/replicaCount': minimum: got 0, want 1. helm template also rejects the same values, with the same text without the INSTALLATION FAILED: prefix. With --set replicaCount=3, the installation succeeds.

Investigating the values of a release

Faced with a misbehaving release, these three commands are read in order: get values without options shows what someone overrode, --all shows the merged result actually injected, and get manifest shows the final YAML sent to the cluster. Comparing them pinpoints where your intention was lost.

Terminal window
# Values supplied by the user
helm get values myrelease -n mynamespace
# All the values (merged)
helm get values myrelease -n mynamespace --all
# Generated manifests
helm get manifest myrelease -n mynamespace

Hands-on practice

The lab gives you a catalogue release (podinfo chart 6.16.0) that carries two settings put in place by operations, 3 replicas and an interface color. You upgrade it to 6.17.0 without losing those settings, then you set the interface message to 2026. That value looks like a number, but it must stay a string: this is the typing trap of --set. A version upgrade is precisely the case where --reuse-values is not enough: the "Behavior during upgrades" section explains why.

The validation reads the values and the status of the release: ui.message must be the string 2026, the release must be at 6.17.0, its Pods must run the 6.17.0 image, it must keep its 3 replicas and its original color, and podinfo must answer the message 2026.

Key takeaways

  • The values.yaml of the chart contains the default values: read it with helm show values.
  • -f file.yaml applies overrides from a file: version it in Git.
  • --set is for one-off overrides. It has priority, but is less traceable.
  • Order of precedence: default < -f files (in order) < --set.
  • --reuse-values keeps the old values during an upgrade of the same chart. For a version upgrade, export them with helm get values -o yaml and pass them again with -f. Without --reuse-values, an upgrade that passes at least one --set or -f starts again from the chart defaults; only an upgrade with no value at all takes the old ones.
  • --set-string forces a value into a string, useful for image tags made of digits only; in a -f file, quotes play that role.
  • helm template generates the manifests without deploying, ideal for debugging.

Knowledge check

Five questions drawn at random from the bank of this lesson, on how to supply values to a release and how to find them again afterwards.

Knowledge check

Check what you have learned with this interactive quiz

5 questions
5 min
80% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer