helm --set, --set-string and -f: override chart values
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · v4.3.1+gc0d08d0updated 2026-10-20
- tool
- Helm
- command
- helm install / helm upgrade / helm template
- flag
- --set
- default
- values from values.yaml
--set key=value overrides a value from the chart's values.yaml for one release. Dots address nested keys (image.tag=1.29.0), braces build lists (list={a,b,c}), and commas separate several assignments. Helm guesses the type: true becomes a boolean and 3 an integer, which --set-string prevents.
See how values are typed
helm create mychart >/dev/null
cat > mychart/templates/cm.yaml <<'EOF'
apiVersion: v1
kind: ConfigMap
metadata:
name: cfg
data:
flag: {{ kindOf .Values.flag | quote }}
num: {{ kindOf .Values.num | quote }}
list: {{ .Values.list | join "," | quote }}
host: {{ .Values.ingress.host | quote }}
EOF
helm template demo ./mychart --show-only templates/cm.yaml \
--set flag=true --set num=3 --set 'list={a,b,c}' --set ingress.host=app.example.com
helm template demo ./mychart --show-only templates/cm.yaml --set-string flag=true --set num=3 \
--set 'list={a}' --set ingress.host=x | grep flagOutput
--- # Source: mychart/templates/cm.yaml apiVersion: v1 kind: ConfigMap metadata: name: cfg data: flag: "bool" num: "int64" list: "a,b,c" host: "app.example.com" flag: "string"
Precedence
Later sources win: chart values.yaml, then each -f file in order, then --set/--set-string/--set-file in order.
helm upgrade --install web ./mychart -f values.prod.yaml --set image.tag=1.29.0Syntax
| Flag | Example | Result |
|---|---|---|
| --set | replicaCount=3 | replicaCount: 3 (int) |
| --set | image.tag=1.29.0 | image: {tag: "1.29.0"} |
| --set | 'list={a,b,c}' | list: [a, b, c] |
| --set | servers[0].port=80 | first list item, key port |
| --set | name=a\,b | a literal comma: name: "a,b" |
| --set-string | flag=true | flag: "true" (string) |
| --set-file | config=./app.conf | value read from a file |
| -f / --values | values.prod.yaml | a whole values file |
Sources
Related pages
errors · helmHelm: nil pointer evaluating interface {}.valuehelm template and helm install fail with nil pointer evaluating interface {} when a template reads a nested value whose parent key is missing from values.yaml.commands · kubernetesGenerate Kubernetes YAML with kubectl create --dry-run=client -o yamlkubectl create deployment, service, configmap or secret with --dry-run=client -o yaml prints a ready manifest without a cluster. Save it with > file.yaml.cheat sheets · kuberneteskubectl cheat sheet: everyday Kubernetes commandskubectl cheat sheet: contexts and namespaces, get and describe, logs and exec, apply and rollout, port-forward, scaling, and manifests with --dry-run=client.