Different methods to pass values into Helm:
- Directly modify values.yaml file in Helm chart (not recommended)
- Instead of editing values.yaml file directly, we can pass values into Helm via CLI. For example to change replicaCount value we can use:
helm install --set [values_property_name]=[number] [release_name] [chart_name] helm install --set replicaCount=2 app helloworld
- You can define your own values.yaml file to define custom variables:
helm install -f [custom_values_file] [release_name] [chart_name] helm install -f myvalues.yaml app helloword/
- Use key-pair values to pass data into Helm. To use these values we need to iterate through them. For example:
// env-values.yaml // Define custom config key-pair values yaml file map: vars: - name: "USERNAME" value: "john" - name: "PASSWORD" value: "P@ssw0rd"
- After defining separate file for environment variables, edit your deployment.yaml file to iterate through the values:
... env: {{- range .Values.vars }} - name: {{ .name }} value: {{ .value }} {{- end }} ...
Useful Helm commands
- To list Helm releases use:
helm list
- To delete Helm release use:
helm delete [release_name]
- Use Helm template command to see values that will be used during chart installation:
helm template -f [env_values_file_name] [chart_name] helm template -f env-values.yaml helloworld/