Helm: Render Chart Templates Locally – Example

Helm chart templates in a combination with a values.yaml file, generate manifest files which are YAML-formatted Kubernetes resource descriptions.

The values.yaml file contains default configuration values for a chart.

These default values can be overriding with custom values using special flags.

Before applying to a Kubernetes cluster, the Helm chart templates can be rendered locally and printed to a terminal or saved to a file.

In this note i will show the examples of how to render the Helm chart templates locally using a helm template command.

Cool Tip: How to download a Helm chart and save it locally! Read more →

Render Helm Chart Templates

Add a Helm chart repository, from which you want to render a chart template:

$ helm repo add <REPO_NAME> <REPO_URL>
- example -
$ helm repo add nginx https://helm.nginx.com/stable

Update a cache:

$ helm repo update

To render the Helm chart template, execute:

$ helm template <CHART_NAME> <REPO_NAME>/<PATH_TO_CHART>
- example -
$ helm template nginx-ingress nginx/nginx-ingress

To render a specific version of the Helm chart:

$ helm template <CHART_NAME> <REPO_NAME>/<PATH_TO_CHART> --version=<CHART_VERSION>
- example -
$ helm template nginx-ingress nginx/nginx-ingress --version=0.15.1

Cool Tip: List Helm charts and repositories using a helm command! Read more →

While rendering the Helm chart template you can override the default chart values, by using a --set flag:

$ helm template <CHART_NAME> <REPO_NAME>/<PATH_TO_CHART> --set <VAR>=<VAL>
- example -
$ helm template nginx-ingress nginx/nginx-ingress --set replicaCount=1 \
                                                  --set service.create=false

You can also pass in a new value file (or multiplie) using a --values flag:

$ helm template <CHART_NAME> <REPO_NAME>/<PATH_TO_CHART> --values=<FILE_NAME>
- example -
$ helm template nginx-ingress nginx/nginx-ingress --values ./baseSettings.yaml \
                                                  --values ./customSettings.yaml
Was it useful? Share this post with the world!

Leave a Reply