How to use Helm in Kubernetes

H

Think of Helm as a package manager: pacman in Arch Linux, apt-get in Ubuntu or yum/dnf in Red Hat/Fedora. Helm is developed by Deis and helps us manage K8s applications. With Helm Charts it has become a joke launching, maintaining, updating, reverting to a previous version, or deleting apps in Kubernetes.

A chart is easy to create, maintain, and distribute. Charts are pre-configured Kubernetes resource packs.

The latest version of Helm is maintained by the Cloud Native Computing Foundation (CNCF), in collaboration with Microsoft, Google, Bitnami, and Helm contributors.

Helm is used for:

• searching and using popular software packaged as Kubernetes charts
• distributing their own applications as Kubernetes charts
• intelligent management of Kubernetes manifest files
• managing versions of Helm packages

Helm consists of two parts: the client (helm) and a server (tiller).

The tiller server runs inside the K8s cluster and manages chart installations.

Charts are Helm packages that contain at least 2 things:

• a package description (chart.yaml)
• one or more templates containing the Kubernetes manifest files

Charts can be stored on disk or brought from chart deposits (just like Debian, Ubuntu, or Red Hat).

Helm installation

To install Helm you must:

• have access to a Kubernetes cluster
• decide what kind of security settings you apply to your installation (or if applicable, to apply such settings)
• install and configure the two components: Helm and Tiller.

If we install Helm on a cluster on which we have complete control (for example, minikube or a cluster built into a private network where sharing is not a problem), the default installation, where we do not have to worry about security, is the most simple.

So I will continue with the default installation without setting up additional security steps. Supposing that we have a cluster configured here, there are several ways to install Helm, but I chose the one which installs Helm locally with a script: we will download this script and then run it.

$ curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get >get_helm.sh
$ chmod 700 get_helm.sh
$ ./get_helm.sh

Tiller installation

Tiller, the server side of Helm, is usually installed inside the Kubernetes cluster. But sometimes for development, it can also be installed locally and then configured to communicate with a Kubernetes cluster.

We will install it on the cluster. The easiest way to install a tiller on a cluster is to run the helm init command. This command will validate the local environment in which Helm is installed and will do the necessary configuration: connect to the cluster to which the kubectl command connects (run the kubectl config view command) and then install the tiller in the kube-system namespace.

So, as suggested at the end of installing Helm, run the boot command and install Tiller:

$ helm init

After running this command, we will be able to run the kubectl get podsnamespace kube-system and view the Tiller pod.

Now, running the helm version will show us what version of Helm and Tiller are (so you do not have to worry about it later, it’s recommended that the two of them to be the same version).

To upgrade Tiller, we’ll run:

$ helm init – upgrade

To delete the Tiller (and optionally the local configuration that, in default, is in ~/.helm):

$ helm reset

Installing a chart

Helm has several ways to install a chart, but the simplest is the official Helm stable depository.

$ helm repo update # This command makes you sure that the entire list of charts has been updated
$ helm search # this command will display all the charts in the stable store
$ helm inspect stable/mariadb # this command shows us the capabilities and how is a chart is configured
$ helm install stable/mariadb

This article presents only the surface part of everything that Helm can do in Kubernetes – the subject is far too complex to be covered in just a few lines. I hope you have succeeded in raising your interest in Helm and looking forward to learn more.

Recent Posts

Archives

Categories