does helm have feature of print?

9/14/2019

As we knew, helm charts are made by templates with variables and reference values from values.yml. I'd like to review the final heml chart, but there is no print or output feature.

For example, in serverless framework, I can run sls print to get the final serverless.yml

But I can't find the similar command in heml, such as

helm print <chart_name> -f values.yml
-- Bill
kubernetes
kubernetes-helm

2 Answers

9/14/2019

Make use of --debug and --dry-run option.

helm install ./mychart --debug --dry-run

Quoting statement from this official doc.

When you want to test the template rendering, but not actually install anything, you can use helm install ./mychart --debug --dry-run. This will send the chart to the Tiller server, which will render the templates. But instead of installing the chart, it will return the rendered template to you so you can see the output.

There is another way to do this without need of connection to tiller.

helm template ./mychart

Hope this helps.

Update:

Printing rendered contents of one of the stable chart (in my case airflow stable chart) would look like:

  • Using --debug and --dry-run option
helm install --namespace "airflow" --name "airflow" stable/airflow --debug --dry-run -f values.yaml
  • Using helm template
helm fetch stable/airflow
tar -xvf airflow-4.0.8.tgz
helm template --namespace "airflow" --name "airflow" ./airflow -f airflow/values.yaml
-- mchawre
Source: StackOverflow

5/8/2020

updates

Somehow, directly run helm template ./mychart doesn't work any more with below error.

For example,

$ git clone git@github.com:helm/charts.git
$ cd charts/stable/datadog
$ helm template . 

Error: found in Chart.yaml, but missing in charts/ directory: kube-state-metrics

There are two new files in this folders

requirements.yaml
requirements.lock

they both mentioned a repository called https://kubernetes-charts.storage.googleapis.com/

So we need add it in helm

helm repo add common https://kubernetes-charts-incubator.storage.googleapis.com/
helm dependency update
helm template .

Now everything works as normal.

For your reference, my current helm version is v3.2.1.

-- Bill
Source: StackOverflow