Posted on 4 March 2020, updated on 5 December 2022.
For a few months now, you can use Helm 3, the latest major Helm release. With a new architecture, client-only architecture, Helm 3 is more secure and simpler to use. Learn with this article, what are the main commands to use correctly Helm 3.
Why do we use Helm 3?
What is exactly Helm?
A chart is a collection of files that describe a related set of Kubernetes resources. With a single chart, you can run a basic application or something more complex, like a full web app inside the Kubernetes cluster. Helm charts help you define, install and upgrade even the most complex Kubernetes application.
What are the main differences between Helm 3 and the previous version?
One of the biggest differences between Helm 2 and Helm 3 is its architecture. Indeed, there is no more Tiller (the server-side component of Helm 2). It was configured to have full access to all Kubernetes clusters. With the removal of Tiller, this new architecture Helm 3 is more secure. Helm interacts directly with the Kubernetes API server. The permissions are based on the Kubernetes config file. This means you can restrict user permissions.
If you want to see how to package and deploy an app in the Kubernetes cluster with Helm 2, check this article.
How to install Helm 3?
To install Helm 3, it’s pretty simple. You just have to write these 3 commands line in your console:
##First you download the script, then you give it the right to be executed and then you launch it.
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 chmod 700 get_helm.sh ./get_helm.sh
Then, use the next command to check if everything is set up. If you see the version of your helm, well done you did it!
How to use Helm 3?
Now that we know what version 3 of the package manager is and how to install it, let’s see how to use it.
Helm works inside Kubernetes and uses by default the kubeconfig file (“~/.kube/config”). You can use another file if you set the environment variable $KUBECONFIG.
You’ll find, next, the common commands of Helm 3. To get more information about a command, use:
helm <COMMAND> --help
To upload a chart to Kubernetes, you can use the following command:
helm install [NAME] [CHART]
If you want to upgrade your chart, use the following command and choose the release you want:
helm upgrade [RELEASE] [CHART]
You can add the flag -i or --install if you want to run an install before if a release by this name doesn’t already exist.
Otherwise, you can do a rollback. If you do not specify the revision, it will rollback to the previous version.
helm rollback [RELEASE] [REVISION]
To retrieve a package from a package repository, and download it locally:
helm pull [CHART]
You have two commands to search:
helm search hub
This command search for charts in the Helm Hub.
helm search repo
These commands search repositories that you have added to your local helm client. This search is done over local data, and no public network connection is needed.
If you want to uninstall a release, here is the command:
helm uninstall [RELEASE]
You have a few commands to interact with chart repositories. A repository is a place where you can find and share charts.
You can add a chart repository:
helm repo add [NAME] [URL]
You can list chart repositories:
helm repo list | ls
You can remove a chart repository:
helm repo remove | rm [NAME]
And finally, you can get the latest information about charts from the respective chart repositories:
helm repo update
Helm 3 supports OCI for package distribution. Chart packages are able to be stored and shared across OCI-based registries. But be careful, it is considered experimental.
To use the following commands, you have to set
HELM_EXPERIMENTAL_OCI in the environment
Then you can work with registries and local cache with the commands below.
You can log in to a registry (with manual password entry):
helm registry login [HOST]
$ helm registry login -u myuser localhost:5000 Password: Login succeeded To logout, use the command: $ helm registry logout [HOST]
And be attentive, an issue is open to simplifying the install chart from registry. Instead of writing this:
helm registry login helm chart pull ... helm chart export ... ./charts helm install ... /charts/my-chart
You could write only one command line, which is:
helm install gcr.io/my-project/my-chart@sha256:xxx --from-registry
helm chart install my-chart@sha256:xxx
helm status [RELEASE]
This command shows you the status of your release. The status consists of:
- last deployment time
- kubernetes namespace in which the release lives
- state of the release (can be: unknown, deployed, uninstalled, superseded, failed, uninstalling, pending-install, pending-upgrade, or pending-rollback)
- list of resources that this release consists of, sorted by kind
- details on the last test suite run, if applicable
- additional notes provided by the chart
helm list | helm ls
You can list all applications that have been installed in the cluster using helm.
helm history [RELEASE]
You can see with this command all the historical revisions for a given release.
Create your own chart
helm create [NAME]
This command creates a chart directory with the common files and directories used in a chart.
helm create test will create a directory structure:
helm package [CHART]
This command packages a chart into a versioned chart archive file.
helm lint [CHART]
This command takes a path to a chart and runs a series of tests to verify that the chart is well-formed.
With these commands, you are now able to deploy your app on Kubernetes with Helm 3.