Overriding with --set

The --set flag overrides individual values on the command line without editing any files.

Syntax--set key=value,nested.key=value

--set lets you override single values inline at install or upgrade time. It is ideal for quick, one-off changes.

Syntax

  • Nested keys use dots: --set image.tag=1.26.
  • Multiple values: separate with commas or repeat the flag.
  • Lists use braces or indices: --set ports={80,443} or --set servers[0].port=80.

Related flags

  • --set-string — force the value to be treated as a string.
  • --set-file — read the value's content from a file.

Example

Example · bash
# Override several values inline
helm install my-web ./mychart \
  --set replicaCount=3 \
  --set image.tag=1.26 \
  --set service.type=LoadBalancer

# Force a string, and set a list
helm upgrade my-web ./mychart \
  --set-string image.tag="1.26" \
  --set ingress.hosts={a.example.com,b.example.com}

When to use it

  • A CI pipeline passes the image tag as --set image.tag=${GIT_SHA} so every build deploys the exact image built from that commit without editing any files.
  • An operator quickly changes the replica count on a running release with --set replicaCount=5 without modifying the values file or re-cloning the chart.
  • A developer uses --set-string to force a numeric-looking version string like '1.0' to be treated as a YAML string rather than a float.

More examples

Override a single value

Overrides just the image tag for an upgrade, leaving all other values unchanged.

Example · bash
helm upgrade my-app ./my-chart \
  --set image.tag=v2.3.1 \
  -n production

Override multiple values

Chains multiple --set flags to override several independent values in one command, commonly used in CI pipelines.

Example · bash
helm upgrade --install my-app ./my-chart \
  --set replicaCount=3 \
  --set image.tag=${IMAGE_TAG} \
  --set service.type=LoadBalancer \
  -n production

Set string and list values

Shows --set-string for string coercion and indexed bracket syntax for setting items within a YAML list.

Example · bash
# Force a value to be a string (not parsed as a number)
helm install my-app ./chart --set-string version="1.0"
# Set a list element by index
helm install my-app ./chart --set ingress.hosts[0].host=app.example.com

Discussion

  • Be the first to comment on this lesson.