Helm is the best way to find, share, and use software built for Kubernetes.

What is Helm?

Helm is widely known as “the package manager for Kubernetes“. Although it presents itself like this, its scope goes way beyond that of a simple package manager. However, let’s start at the beginning.

Helm is an open-source project which was originally created by DeisLabsand donated to CNCF, which now maintains it. The original goal of Helm was to provide users with a better way to manage all the Kubernetes YAML files we create on Kubernetes projects.

The path Helm took to solve this issue was to create Helm Charts. Each chart is a bundle with one or more Kubernetes manifests – a chart can have child charts and dependent charts as well. 

This means that Helm installs the whole dependency tree of a project if you run the install command for the top-level chart. You just a single command to install your entire application, instead of listing the files to install via kubectl.

Charts allow you to version your manifest files too, just like we do with Node.js or any other package. This lets you install specific chart versions, which means keeping specific configurations for your infrastructure in the form of code. 

Helm also keeps a release history of all deployed charts, so you can go back to a previous release if something went wrong.

Helm supports Kubernetes natively, which means you don’t have to write any complex syntax files or anything to start using Helm. Just drop your template files into a new chart and you’re good to go.

But why should we use it? Managing application manifests can be easily done with a few combinations of commands.

Why Should You Use Helm?

Helm really shines where Kubernetes didn’t go. For instance, templating. The scope of the Kubernetes project is to deal with your containers for you, not your template files. 

This makes it overly difficult to create truly generic files to be used across a large team or a large organization with many different parameters that need to be set for each file. 

And also, how do you version sensitive information using Git when template files are plain text?

The answer: Go templates. Helm allows you to add variables and use functions inside your template files. This makes it perfect for scalable applications that’ll eventually need to have their parameters changed.

How to Create a Helm Chart

It’s pretty easy to create a chart in Helm. First, you need to have Helm installed. Then, just type in helm create and it will create a directory filled with files and other directories. Those files are required for Helm to create a chart. 

Let’s take a closer look at what this file tree looks like and what the files are within it:

  • chart.yaml: This is where you’ll put the information related to your chart. That includes the chart version, name, and description so you can find it if you publish it on an open repository. Also in this file you’ll be able to set external dependencies using the dependencieskey.
  • values.yaml: Like we saw before, this is the file that contains defaults for variables.
  • templates (dir): This is the place where you’ll put all your manifest files. Everything in here will be passed on and created in Kubernetes.
  • charts: If your chart depends on another chart you own, or if you don’t want to rely on Helm’s default library (the default registry where Helm pull charts from), you can bring this same structure inside this directory. Chart dependencies are installed from the bottom to the top, which means if chart A depends on chart B, and B depends on C, the installation order will be C ->B ->A.

How to Host a Helm Chart

Ok, you created your chart, now what? Do we have to download the entire repository to install those charts? No! Helm has a public library for the most used charts, which kind of works like Docker Hub. 

You can also create your own chart repository and host it online. Helm drinks from the same fountain as HomeBrew, or Linux. You can tap these repositories to download charts contained in them. 

Since a chart repository is basically an index.yaml file served from a static web server, you can pretty much create a chart repository out of anywhere.

Take Zaqar, for example – it’s hosted on GitHub Pages and is accessible through my domain. When Helm looks for an index.yaml file it’s actually looking for the list of available versions of that chart, their SHA256 digests, and the location of the packaged .tgz file to download the chart itself. This is pretty much what NPM does under the hood (overly simplified).

This means we don’t need to have your repository cloned forever, and our charts can be private as well. We only need to create a chart repository. 

We can even use hosted services like Azure CR to do the job, or we can have a full solution called Chart Museum, which allows us to store your charts and provides us with a neat UI.

Information Source – https://www.freecodecamp.org/news/what-is-a-helm-chart-tutorial-for-kubernetes-beginners/