What is Helm
Helm is a package manager for Kubernetes that uses a packaging format called charts, and is implemented into two distinct parts: Helm Client and Helm Library. [1]
Helm installs charts into Kubernetes, creating a new release for each installation. And to find new charts, you can search Helm chart repositories.
-
A chart is a bundle of information to create an instance of a Kubernetes application called a release
-
and a repository is the place where charts can be collected and shared.
-
A release is a running instance of a chart, combined with
-
a specific config that contains configuration information that can be merged into a packaged chart to create a releasable object.
1. Installing Helm
The Helm can be installed from the official binary releases and the community package managers. [2]
Every release of Helm provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed.
-
Download a desired version that supported between Helm and Kubernetes.
-
Unpack it (
tar -zxvf helm-v3.0.0-linux-amd64.tar.gz
) -
Find the helm binary in the unpacked directory, and move it to its desired destination (
mv linux-amd64/helm /usr/local/bin/helm
)
For example, to install a version 3.14.x
Helm that supports Kubernetes between 1.29.x
and 1.26.x
:
curl -sLO https://get.helm.sh/helm-v3.14.2-linux-amd64.tar.gz
tar xf helm-v3.14.2-linux-amd64.tar.gz
sudo cp linux-amd64/helm /usr/local/bin/
The following script is used to install Helm from Apt (Debian/Ubuntu):
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
It’s recommended to run the following command to generate the completion scripts for the specified shell (e.g., Bash):
helm completion bash | sudo tee /etc/bash_completion.d/helm > /dev/null
source /usr/share/bash-completion/bash_completion # reload the completion scripts
2. Initialize a Helm Chart Repository
Once the Helm is ready, a chart repository can be added using helm repo add
command. Check Artifact Hub for available Helm chart repositories. [3]
For example, to install the bitnami
repo:
helm repo add bitnami https://charts.bitnami.com/bitnami
Once installed, it is able to list the available charts:
$ helm search repo bitnami
NAME CHART VERSION APP VERSION DESCRIPTION
bitnami/airflow 17.2.1 2.8.2 Apache Airflow is a tool to express and execute...
bitnami/apache 10.9.1 2.4.58 Apache HTTP Server is an open-source HTTP serve...
bitnami/apisix 2.10.0 3.8.0 Apache APISIX is high-performance, real-time AP...
...
3. Using Helm
To install a chart, you can run the helm install
command. Helm has several ways to find and install a chart, but the easiest is to use the bitnami charts. [3]
-
Make sure getting the latest list of charts.
$ helm repo update bitnami Hang tight while we grab the latest from your chart repositories... ...Successfully got an update from the "bitnami" chart repository Update Complete. ⎈Happy Helming!⎈
-
Install
bitnami/mysql
chart.$ helm install bitnami/mysql --generate-name NAME: mysql-1709977095 LAST DEPLOYED: Sat Mar 9 17:38:19 2024 NAMESPACE: default STATUS: deployed REVISION: 1 ...
-
List the deployed releases.
$ helm list NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION mysql-1709977095 default 1 2024-03-09 17:38:19.258433628 +0800 CST deployed mysql-9.23.0 8.0.36
-
Uninstall a release.
$ helm uninstall mysql-1709977095 release "mysql-1709977095" uninstalled
3.1. 'helm search': Finding Charts
Helm comes with a powerful search command. It can be used to search two different types of source: [4]
-
helm search hub
searches the Artifact Hub, which lists helm charts from dozens of different repositories. -
helm search repo
searches the repositories that you have added to your local helm client (with helm repo add). This search is done over local data, and no public network connection is needed.
3.2. 'helm install': Installing a Package
To install a new package, use the helm install
command. At its simplest, it takes two arguments: A release name that you pick, and the name of the chart you want to install. [4]
The helm install
command can install from several sources:
-
A chart repository
helm install happy-panda bitnami/wordpress
-
A local chart archive (
helm install foo foo-0.1.1.tgz
) -
An unpacked chart directory (
helm install foo path/to/foo
) -
A full URL (
helm install foo https://example.com/charts/foo-1.2.3.tgz
)
To keep track of a release’s state, or to re-read configuration information, you can use helm status
:
helm status happy-panda
Customizing the Chart Before Installing
To see what options are configurable on a chart, use helm show values
:
helm show values bitnami/wordpress
There are two ways to pass configuration data during install:
-
--values
(or-f
): Specify a YAML file with overrides. This can be specified multiple times and the rightmost file will take precedence -
--set
: Specify overrides on the command line.-
Values that have been
--set
can be viewed for a given release withhelm get values <release-name>
. -
Values that have been
--set
can be cleared by runninghelm upgrade
with--reset-values
specified.
-
3.3. 'helm upgrade' and 'helm rollback': Upgrading a Release, and Recovering on Failure
When a new version of a chart is released, or when you want to change the configuration of your release, you can use the helm upgrade command. [4]
helm upgrade -f panda.yaml happy-panda bitnami/wordpress
Now, if something does not go as planned during a release, it is easy to roll back to a previous release using helm rollback [RELEASE] [REVISION]
.
helm rollback happy-panda 1
And we can use helm history [RELEASE]
to see revision numbers for a certain release.
3.4. 'helm uninstall': Uninstalling a Release
When it is time to uninstall a release from the cluster, use the helm uninstall
command: [4]
helm uninstall happy-panda
3.5. 'helm repo': Working with Repositories
Helm 3 no longer ships with a default chart repository. The helm repo
command group provides commands to add, list, and remove repositories. [4]
You can see which repositories are configured using helm repo list
:
helm repo list
And new repositories can be added with helm repo add
:
helm repo add dev https://example.com/dev-charts
Because chart repositories change frequently, at any point you can make sure your Helm client is up to date by running helm repo update
.
Repositories can be removed with helm repo remove
.
3.6. 'helm create': Creating Your Own Charts
The Chart Development Guide explains how to develop your own charts. But you can get started quickly by using the helm create command: [4]
$ helm create deis-workflow
Creating deis-workflow
Now there is a chart in ./deis-workflow
. You can edit it and create your own templates.
As you edit your chart, you can validate that it is well-formed by running helm lint
.
When it’s time to package the chart up for distribution, you can run the helm package
command:
$ helm package deis-workflow
deis-workflow-0.1.0.tgz
And that chart can now easily be installed by helm install
:
$ helm install deis-workflow ./deis-workflow-0.1.0.tgz