53

I want to export already templated Helm Charts as YAML files. I can not use Tiller on my Kubernetes Cluster at the moment, but still want to make use of Helm Charts. Basically, I want Helm to export the YAML that gets send to the Kubernetes API with values that have been templated by Helm. After that, I will upload the YAML files to my Kubernetes cluster.

I tried to run .\helm.exe install --debug --dry-run incubator\kafka but I get the error Error: Unauthorized.

Note that I run Helm on Windows (version helm-v2.9.1-windows-amd64).

j9dy
  • 2,029
  • 3
  • 25
  • 39

5 Answers5

73

We need logs to check the Unauthorized issue.

But you can easily generate templates locally:

helm template mychart

Render chart templates locally and display the output.

This does not require Tiller. However, any values that would normally be looked up or retrieved in-cluster will be faked locally. Additionally, none of the server-side testing of chart validity (e.g. whether an API is supported) is done.

More info: https://helm.sh/docs/helm/helm_template/

Ed Randall
  • 6,887
  • 2
  • 50
  • 45
Amrit
  • 1,964
  • 19
  • 25
27

Amrit Bera's solution will only work with local helm chart, per the details of your question you want it to work with remote helm chart, that's a feature that will be added to Helm v3 (Work in Progress currently).

RehanSaeed posted the following workaround (https://github.com/helm/helm/issues/4527)

Basically:

mkdir yamls
helm fetch --untar --untardir . 'stable/redis' #makes a directory called redis 
helm template --output-dir './yamls' './redis' #redis dir (local helm chart), export to yamls dir

The good thing about this is you can mix this technique with weaveworks flux for git ops + this gives you another option for using Helm v2 without tiller, in addition to the Tiller Plugin (which lets you run tiller locally, but doesn't work smoothly).

neoakris
  • 4,217
  • 1
  • 30
  • 32
12

Straight from the helm install --help

To check the generated manifests of a release without installing the chart,
the '--debug' and '--dry-run' flags can be combined. This will still require a
round-trip to the Tiller server.
quant
  • 2,184
  • 2
  • 19
  • 29
George Miller
  • 933
  • 7
  • 6
3

If you want to see only the resolved YAML you can use

helm template .

I prefer to see it on a file

helm template . > solved.yaml
Santiago Ceron
  • 139
  • 1
  • 5
2

This is not the answer for the question but this post on stackoverflow is the first one which was displayed in searchengines when i was searching for a solution of my problem and solved it by myself reading the Helm CLI docs. I post it here anyway because maybe someone else is searching for the same usecase as i did.

For already installed Helm charts on a Kubernetes cluster you can use the following command to export/download all information for a named release:

 helm get all <release-name>

or

helm get all <release-name> > installed-kubernetes-resources.yaml

If you only want e.g. the manifests or values instead of all, just replace the all command appropriately (get more details by using helm get --help):

Usage:
  helm get [command]

Available Commands:
  all         download all information for a named release
  hooks       download all hooks for a named release
  manifest    download the manifest for a named release
  notes       download the notes for a named release
  values      download the values file for a named release

If you want to export the information for a named release with a distinct revision you can use the flag --revision int in your get command (helm get all --help). To list all possible revisions of your named release just use the command helm history <release-name>.

My Helm CLI version: version.BuildInfo{Version:"v3.5.0", GitCommit:"32c22239423b3b4ba6706d450bd044baffdcf9e6", GitTreeState:"clean", GoVersion:"go1.15.6"}

snukone
  • 312
  • 3
  • 10