Helm
Kubernetes
Configuration
Deployment
DevOps
How to set multiple values with helm?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Helm provides several ways to set multiple values: --set key=value flags (inline, one per flag), -f values.yaml files (bulk configuration), --set-string for explicit string values, and --set-json for complex structures. For production use, prefer values files (-f) for readability and version control. Use --set for quick overrides and CI/CD pipelines. Multiple -f files are merged left to right, with later files taking precedence.
Method 1: Multiple --set Flags
Each --set flag sets one key-value pair. Nested keys use dot notation.
Method 2: Comma-Separated --set
This is more compact but harder to read for many values.
Method 3: Values Files (-f)
Method 4: Multiple Values Files (Merged)
Method 5: --set with Complex Types
Arrays/Lists
--set-string for Explicit Strings
--set-json for Complex Structures
Method 6: --set with --values Combined
--set flags always take precedence over -f files.
Helm Upgrade with Values
Debugging Values
Common Pitfalls
- Values containing commas in a single
--setflag: Commas separate key-value pairs in--set. If a value contains a comma, it splits incorrectly. Escape commas with\,:--set annotation="app\,version=1", or use--set-jsoninstead. - Helm interpreting numeric strings as numbers:
--set image.tag=1.25sets the value to the float1.25, not the string"1.25". Use--set-string image.tag=1.25or quote in YAML:tag: "1.25"to ensure it stays a string. - Not quoting special characters in shell: Values with
!,$,{, or spaces need quoting:--set "password=my\!pass"or--set 'password=my!pass'. Without quotes, the shell interprets these characters. - Using
--reuse-valueswithout understanding merge behavior:--reuse-valuestakes the values from the last release and merges your new--setflags. If the chart added new default values in an update, those defaults are not applied because the old values take priority. - Overriding nested maps with
--setinstead of merging:--set resources.limits.cpu=500monly sets that one key. But--set-json 'resources={"limits":{"cpu":"500m"}}'replaces the entireresourcesmap, deleting any existingrequestssection. Be aware of set vs replace semantics.
Summary
- Use
-f values.yamlfor bulk configuration — readable, version-controlled, and mergeable - Use
--set key=valuefor quick overrides and CI/CD pipelines - Use
--set-stringto prevent numeric or boolean interpretation of string values - Use
--set-jsonfor complex structures like arrays and nested objects - Multiple
-ffiles merge left to right;--setalways takes highest precedence

