This is the 1st part of a series called "All about these Helm charts". More articles will follow.
Wait! What is a Helm chart?
To describe a Kubernetes cluster you have to create a series of configuration files that point to the desired state of this cluster. These files have a very powerful descriptive language but miss a way to follow the DRY principle to keep them tidy. For that reason Helm was introduced as a package manager for Kubernetes. Helm charts are used to generate the actual Kubernetes configuration files and, based on the Go templating engine, can take advantage of variables, conditions, loops and others useful technics. A chart consists of a list of templates that resembles the Kubernetes configuration files, a values.yaml
that describes the configurable parameters and a Chart.yaml
that keeps some metadata information, most important one is the version of the chart.
Adding a new chart
Let's say you found a chart (maybe in Helm curated charts repo) and you are ready to try it out. What are the next steps?
Read thoroughly the description and the configurable params in
README.md
.If a param is not clear enough, open the
values.yaml
and check for that specific parameter. Most of the times, the writers leave a commented out example of usage.
For example for env
variable there is a commented out suggested usage:
- If are you uncertain then look how the specific param is used inside the templates.
For example: in templates/deployment.yaml
env
variable is used like this:
- To add the chart to your Helm configuration, edit the
requirements.yaml
file to add the new chart. Remember to add a link to theChart.yaml
in the remote repo (eg. Github) to be able to go that chart easily.
- Run
helm dependencies update
(read more for this command here) and check the new version inrequirements.lock
.
Make your first test, see if this all works out using the default configuration. Use
helm template
orhelm diff
((read more for this plugin here)) to render the changes in templates, read them, understand why they are needed and what changes you would expect to see.Customise the configurable params to your needs and validate again the result using
helm template
orhelm diff
.
And what if you want a different handling of the templates generated? Do make a Pull request
And there you have it! You are ready to deploy a shiny new chart to your Kubernetes cluster!