How do you set nested keys, list items and keys containing dots with `--set`?
IntermediateConceptValues & Precedence
Answer
--set api.resources.limits.memory=512Mi # nested
--set ingress.hosts[0].host=shop.example.com # list index
--set 'ingress.hosts={a.example.com,b.example.com}' # list of scalars
--set podAnnotations."prometheus\.io/scrape"=true # escaped dot in key
--set-string 'podAnnotations.prometheus\.io/port=3000'
--set api.extraArgs=null # delete a default
Commas separate multiple assignments, so a value containing a comma must be escaped (a\,b) or passed via a file. Beyond trivial overrides, a values file is more readable and reviewable.
More on Values & Precedence
What is the precedence order of values in Helm?BeginnerHow are lists merged across values files?IntermediateWhat is the difference between `--set` and `--set-string`?BeginnerWhat are `--set-file`, `--set-json` and `--set-literal` for?IntermediateHow do you remove a default value set in a chart's `values.yaml`?IntermediateWhat does `--reuse-values` do and why is it dangerous?Advanced