Skip to main content

Helm Introduction

Helm is a package manager and templating tool for Kubernetes. It helps you define, install, upgrade, and manage Kubernetes applications using reusable charts. A common comparison is that Helm is like apt, yum, or brew, but for Kubernetes applications.

Its main use case is application deployment and environment-specific configuration management.

Helm Architecture

Helm 3 has a simpler architecture than Helm 2. The server-side component called Tiller was removed, so Helm now works as a client-side application that talks directly to the Kubernetes API server.

Using a Helm Chart

To deploy an application using Helm, you need to create a Helm chart. A Helm chart is a collection of files that describe a related set of Kubernetes resources. A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on.

First, add the chart repository:

helm repo add bitnami https://charts.bitnami.com/bitnami
  • Update the local repository index:
helm repo update
  • Install the chart:
helm install postgres bitnami/postgresql

Search for available charts:

helm search repo bitnami

Search for the available versions of a chart:

helm search repo bitnami/postgresql --versions

You can also pull the chart locally to inspect its files. The --version flag refers to the chart version, not the application version.

helm pull bitnami/postgresql --version 16.3.0

You can pass custom values to the chart with a values file:

helm install postgresql bitnami/postgresql --values values.yaml

For example, the values.yaml file can look like this:

commonAnnotations:
foo: bar

We can upgrade the chart using the following command

helm upgrade --install postgresql bitnami/postgresql --values values.yaml --version=16.4.0 --namespace=my-namespace

You can roll back the chart using the following command. Here postgresql is the release name, which you can get from helm list.

helm rollback postgresql

To check Helm releases:

helm list

To check the values provided by the user. Again, postgresql is the release name:

helm get values postgresql

You can also inspect the rendered Kubernetes manifests generated by the chart. Again, postgresql is the release name:

helm get manifest postgresql

You can uninstall the chart using the following command. Again, postgresql is the release name:

helm uninstall postgresql

Creating our own Helm Chart

  • You can create your own Helm chart using the following command. It generates a directory with the boilerplate files.
helm create mychart
  • You can install the chart using the following command. mychart is the release name and ./mychart is the chart path.
helm install mychart ./mychart

We can also apply with a values file

helm install mychart ./mychart --values values.yaml

Helm Hooks

Helm hooks are a way to interact with the lifecycle of a release. They allow you to intervene at certain points in a release's life cycle. Helm supports the following hooks:

  • pre-install - Runs before any templates are rendered.
  • post-install - Runs after all templates have been rendered and resources have been created.

What's next?