How to Override Helm Chart Values with --set and values files
In this tutorial, you'll learn about How to Override Helm Chart Values with. We cover key concepts, practical examples, and best practices.
The Problem
You deployed a Helm chart with default values but need to customize it, and your --set overrides are ignored or the wrong values are applied because of precedence rules.
Quick Fix
Override a Single Value with --set
helm install my-release bitnami/nginx --set service.type=LoadBalancer
# NAME: my-release
# LAST DEPLOYED: ...
# STATUS: deployed
Use --set for one-off overrides. The format is key=value and nested keys are separated by dots (e.g., service.type).
Use a Custom values File for Multiple Overrides
cat > custom-values.yaml << 'EOF'
replicaCount: 3
service:
type: ClusterIP
port: 9090
ingress:
enabled: true
hostname: myapp.example.com
EOF
helm upgrade --install my-release bitnami/nginx -f custom-values.yaml
# Release "my-release" has been upgraded.
Create a YAML file with your overrides and pass it with -f or --values. This is cleaner than multiple --set flags for many values.
Understand the Precedence Order
helm upgrade --install my-release bitnami/nginx \
--values base-values.yaml \
--values env-values.yaml \
--set image.tag=v2.0
# ...
Precedence from lowest to highest: chart's values.yaml < --values files (later files win) < --set flags. Use this to layer base values, environment overrides, and hotfixes.
Override Nested Values with JSON Path
helm upgrade my-release bitnami/nginx --set-string 'metrics.serviceMonitor.labels.release=prometheus'
# ...
Use --set-string to force string values (useful for labels and annotations). For deeply nested values, quote the entire key path.
Use helm get values to Debug Final Configuration
helm get values my-release
# USER-SUPPLIED VALUES:
# replicaCount: 3
# service.type: LoadBalancer
After deploying with overrides, inspect the final values with helm get values. This shows only the user-supplied values, not the chart defaults, making it easy to verify your overrides are applied correctly.
Additional Troubleshooting
# Check the error message and stack trace for more context
echo "Review the full error output to identify the root cause"
If the above steps do not resolve the issue, examine the complete error message and stack trace. Often the key detail is in the middle of the traceback rather than the final line. Search for the error message in the project documentation or issue tracker for additional solutions.
Use Multiple --set Flags for Complex Configs
helm upgrade my-release bitnami/nginx \\
--set image.tag=1.25.0 \\
--set service.type=LoadBalancer \\
--set service.port=8080
# Release \"my-release\" has been upgraded.
Chain multiple --set flags for complex configurations. Each flag sets one value. For large numbers of overrides, a values file is preferable, but --set is convenient for quick changes.
Prevention
- Store environment-specific overrides in separate values files (e.g.,
values-staging.yaml,values-prod.yaml) - Use
helm get values my-releaseto inspect the final rendered values of a deployed release - Validate your overrides with
helm template --values custom-values.yamlbefore installing - Pin chart versions to avoid unexpected value changes in chart upgrades
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro