Skip to content

Creating a Helm Chart to deploy Kubernetes Components

Tom Barber edited this page Apr 19, 2022 · 8 revisions

Install Helm Client

https://helm.sh/docs/intro/install/

Create a chart from a template

foo@bar:~$ helm create mychart

The Absolute Basics

If you already have a working Kubernetes deployment, lets try and deploy it with no extra templating.

Chart Layout

In your new chart you should have the following layout:

/Chart.yaml
/values.yaml
/templates/

Chart Building

Firstly we should give the chart a sensible name, so edit chart.yaml and update the name, description and if you have an application versioning scheme already in place, its appVersion.

Next copy any kubernetes yaml scripts you already have into the templates directory.

This should give us a working Chart. So let's test a few things.

foo@bar:~$ helm lint .

Should return no errors other than a missing icon.

foo@bar:~$ helm template mychart . 

Should output all the kubernetes manifests to the console. If it fails, run it with the –debug flag and check at where the output fails.

If the above works then the next step is to try and deploy the chart to your kubernetes cluster.

foo@bar:~$ helm install mychart .

If the helm chart deploys properly you should be able to see it and its information in the list output:

foo@bar:~$ helm list

The status should say deployed.

As you continue to make changes you can then either upgrade the chart, or uninstall and reinstall. Sometimes depending on the change, a reinstall is mandatory.

If you upgrade:

foo@bar:~$ helm upgrade mychart .

And then rerun

foo@bar:~$ helm list

You should see it is now at revision 2.

To uninstall run:

foo@bar:~$ helm uninstall mychart

If there are no more changes required to make your Kubernetes code run, then you can publish this to the Unity Helm repository to allow us to deploy it in the Unity platform. If you need to make your code dynamic to accept various variables, then continue on down to the next section

Extending with a Template

Coming Soon.