Everything you need to know about Helm – Part II
In this second part, we are going to learn about Helm versions (v2 vs. v3), the most common commands, and most importantly, we are going to see a practical example of how to use it.
The current version of Helm is Helm3. This was not simply a run-of-the-mill version upgrade – Helm3 introduced major internal differences regarding Helm’s internal workings and how Kubernetes packages were managed.
The biggest change from the previous version (Helm2) was the removal of Tiller, the server component. The reasons for this are explained in the Helm FAQ docs, in the section named ‘Removal of Tiller’.
Some other significant changes in Helm3 are below. Again, they are explained in detail in the FAQ documentation:
- Improved upgrade strategy
- Release names now restricted to the namespace
- ‘Secrets’ used as the default storage driver
- Ability to validate chart values with JSON
- Consolidation of requirements.yaml into chart.yaml
- Automatic creation of namespaces
Let’s now take a look at the most common Helm commands and their usage. The full Helm command list is too long to list here, but you can and should go through it:Helm install: this is the most common command, used for installing new charts. The basic syntax to install a chart from a repo is:
helm install <name> <chart> [flags]
For example, to install nginx v1.16:
helm install mynginx-116 /myrepos/nginx-v116
When you use this chart reference with a repo prefix (‘/myrepos/nginx-v116′), Helm will look in the local configuration for a chart repo named ‘myrepos’, and then look for a chart named ‘nginx-v116’ in that repository.
helm install mynginx-116 https://nginx.org/download/nginx-1.16.1.tar.gz
You may also need to check your list of repos to make sure the repo you want to install from is part of your list. Use this command:
helm repo list [flags]
And if the repo you want is not in your list, you can add it with:
helm repo add [repo-name] [URL] [flags]
helm repo add nginx-v116 https://nginx.org/download/nginx-1.16.1.tar.gz
If you need to update your repos:
helm repo update [flags]
You should also familiarize yourself with the helm create command. This creates a new chart structure (the directories and files we listed above) with the given name. The basic syntax is:
helm create NAME [flags]
And if you want to display a chart’s contents:
helm show all chart [chart-name]
If you need to rollback to a previous release:
helm rollback <RELEASE> [REVISION] [flags]
To uninstall a specific release:
helm uninstall RELEASE_NAME [flags]
Note: You can use the ‘–dry-run’ flag to see which releases will be uninstalled without actually uninstalling them.
Sample Installation Using Helm
Let’s now go through a sample installation and deployment of Nginx using Helm, so you can get an idea of how all these commands are used. We will use Ubuntu for this exercise and assume you already have Kubernetes. If not, first read this article:
Navigate to the directory where you installed Helm:
First, we want to confirm if our repo list contains ‘nginx’:
helm search repo nginx
Depending on the results (check against the nginx source) you may want to add the latest repo:
helm repo add nginx-stable https://helm.nginx.com/stable
And then it’s always a good idea to update your repo list after adding or deleting repos:
helm repo update
Next, install the nginx chart (package):
helm install my-release nginx-stable/nginx-ingress
Or, if nginx is already installed, and you only need to upgrade the version:
helm upgrade my-release nginx-stable/nginx-ingress
And finally, if you ever need to uninstall this nginx version:
helm uninstall my-release
Useful Resources for Learning Helm
Probably the most important resource to start Helm is the official documentation.
As it’s described by the creators and maintainers of Helm, Helm has a lot of documentation. A high-level overview of how it’s organized will help you know where to look for certain things:
Tutorials take you by the hand through a series of steps to create your first Helm chart. Start here if you’re new to Helm.
Topic guides discuss key topics and concepts at a fairly high level and provide useful background information and explanation.
Community Guides discuss topics centered around Helm’s community. Start here if you want to learn more about the development process of Helm itself and how you can contribute.
How-to guides are recipes. They guide you through the steps involved in addressing key problems and use-cases. They are more advanced than tutorials and assume some knowledge of how Helm works.
You hopefully now have a pretty good idea of Helm – what it does, why we use it, and where it fits into the Kubernetes ecosystem (think of Helm as the ‘apt’ or ‘rpm’ equivalent for Kubernetes). And you also have a good idea of some Helm sample commands and how to install and deploy a simple app using Helm.