0
0
KubernetesHow-ToBeginner · 4 min read

How to Customize Helm Chart Values for Kubernetes Deployments

You can customize Helm chart values by using the --set flag to override specific values directly in the command line or by creating a values.yaml file with your custom settings and passing it with -f during installation or upgrade. This lets you change configurations without modifying the original chart.
📐

Syntax

The basic syntax to customize Helm chart values includes two main methods:

  • helm install my-release chart-name --set key=value overrides a single value.
  • helm install my-release chart-name -f custom-values.yaml uses a file with multiple custom values.

The --set flag is for quick, small changes, while -f is better for complex or many customizations.

bash
helm install my-release chart-name --set key=value
helm install my-release chart-name -f custom-values.yaml
💻

Example

This example shows how to customize the nginx Helm chart by setting the replica count and service type using both --set and a values.yaml file.

bash
# Create a custom values file named custom-values.yaml
replicaCount: 3
service:
  type: LoadBalancer

# Install nginx chart with custom values file
helm install my-nginx bitnami/nginx -f custom-values.yaml

# Or override values directly
helm install my-nginx bitnami/nginx --set replicaCount=3 --set service.type=LoadBalancer
Output
NAME: my-nginx LAST DEPLOYED: <timestamp> NAMESPACE: default STATUS: deployed REVISION: 1 TEST SUITE: None
⚠️

Common Pitfalls

Common mistakes when customizing Helm chart values include:

  • Using incorrect key names that don't match the chart's values.yaml structure.
  • Forgetting to quote values with special characters in --set.
  • Overriding nested values incorrectly without using dot notation.
  • Not validating the custom values file syntax, causing install failures.

Always check the chart's default values.yaml to know the correct keys and structure.

bash
# Wrong: missing dot notation for nested keys
helm install my-nginx bitnami/nginx --set service type=LoadBalancer

# Right: use dot notation
helm install my-nginx bitnami/nginx --set service.type=LoadBalancer
📊

Quick Reference

CommandDescription
helm install my-release chart-name --set key=valueOverride a single value directly in the command line
helm install my-release chart-name -f values.yamlUse a custom values file for multiple settings
helm upgrade my-release chart-name -f values.yamlUpdate an existing release with new values
helm get values my-releaseView current values of a deployed release
helm template chart-name -f values.yamlRender templates locally with custom values

Key Takeaways

Use --set for quick, single value overrides and -f for complex or multiple customizations.
Always check the chart's default values.yaml to know correct keys and structure.
Use dot notation to override nested values correctly with --set.
Validate your custom values.yaml file syntax to avoid deployment errors.
You can update existing releases with customized values using helm upgrade.