Introduction to the Helm Package Manager for Kubernetes

Photo of author

By admin

Kubernetes is a simple yet efficient platform that helps you manage containerized applications as well as lets you deploy them. Kubernetes is simple and beginner-friendly but the deployment of applications in this container-orchestration system is not easy. The whole process of deployment and containerizing involves the creation of several interdependent Kubernetes resources that allow a particular app to deploy and run in different environments.

The resources may include pods, services, deployments, and replica sets with a detailed YAML manifest file for each of these resources. Creating the YAML file requires both your time and effort. However, if you use Helm, the whole process of setting up an application will become much easier. In this post, we will talk about the Helm Package Manager for Kubernetes, how it works, and how to use Helm for containerizing applications.

What is the Helm?

Helm is a Kubernetes package manager, which developers use to package, configure, and deploy web applications and their resources onto the Kubernetes cluster with ease. Helm is similar to yum and apt that shows you Helm charts based on the applications’ resources. Basically, Helm is a collection of your applications’ versions, pre-configured resources stuck together into one small unit.

It is an official part of the CNCF (Cloud Native Computing Foundation) non-profit organization that supports developers creating open-source projects within and outside of the Kubernetes ecosystem. Let’s have a look at the things that developers can do with the help of the Helm package manager in Kubernetes:

  • Helm can help to install software
  • While installing the software, it can automatically install the dependencies of the software
  • It can upgrade various software
  • Allows to configure its deployments or resources
  • Retrieve software packages from repositories

Helm works with Kubernetes command-line tool that has a simple user interface. The command line allows you to manage all the functions provided by the Helm package manager.

Why is the Helm Package Manager Important?

Developers use Kubernetes to containerize applications so that the applications can stay lightweight and portable. Combining all the resources and equipment of a tool into a single container helps you to easily share it with other people. You can’t share a tool that is specially designed for Windows with a macOS user. However, Kubernetes can help you create cross-platform applications.

Now, you might be thinking, if Kubernetes already allows you to do that, why do you need an application manager?

When Kubernetes was launched, developers used to deploy a new code to a Kubernetes cluster. The deployment process consists of the following steps:

  1. You will have to create services such as a ClusterIP or load balancer that work with a relevant configuration for other configurations of the ports. This step is to make it clear how Kubernetes displays the application that runs in the service.
  2. Next, create a deployment that would let you configure the rollout or rollback version of the Kubernetes code and help you manage the application resources and configure the pod or container scaling.
  3. Next, manage all the Kubernetes services using the “kubectl create secret” command.
  4. Then run the “kubectl set image” command with new container images and deployment name to start the container inside a pod.

However, the whole process is lengthy and tiresome. Also, since it contains so many kubectl commands, it will be problematic to handle by a single individual. If there is one wrong space in the command line that you need to execute through the terminal, the whole application management process could possibly go wrong.

That’s why developers created Helm to simplify the application management process in Kubernetes. Helm contains a CLI tool and charts to bring all the configurations of the application into one place. Therefore, it allows you to manage and maintain all the resources of an application from one place.

Helm comes with a set of commands that you can use to modify the lifecycle of the containerized applications. You can configure your applications and their services with the commands before and after the installation process of the application. The commands also help you upgrade services of the app and create dependencies for a specific service. You can organize the different configurations of the app in a YAML file so that the whole deployment process becomes fast and easy.

Why Use Helm?

Writing and organizing the YAML manifests of the Kubernetes application resources is quite time-consuming and wearying. To complete the deployment of applications fast, you will need to manage at least 3 YAML files that have hardcoded and duplicated values of the application resources. To simplify this process, you can use Helm CLI and create a single package that you can deliver to the Kubernetes cluster to make the deployment process easier.

You can install the Helm application on your client computer, and after installing, it will use the Helm server named Tiller to receive requests from the client and install the package on your Kubernetes cluster.

You can access helm charts from the Helm repository and add them to your Kubernetes cluster. If you want to find a chart quickly, simply search for it in the Helm registry with the name of the particular application you want to add to the cluster. For example, if you want to deploy a macOS application on Kubernetes, you will have to create Yaml manifest files with the services and metadata of the application. You can go to the Helm registry and search for the helm chart using the name of the application. A few seconds later, you will find the helm chart you want to deploy on the cluster.

The only thing that is complex about the process is remembering the name of each required Helm chart. So, you can note down the names of the applications and their resources names to make the deployment process hassle-free.

How to Use Helm?

Helm has become quite popular and emerged as a leading Kubernetes application package manager. Helm is supported by its worldwide community of developers and industry leaders and delivers many open-source charts. These open-source charts help you go further with the deployment process of Kubernetes locations. The charts are usable, or you can reconfigure them as per your own requirements.

Helm charts are usually stored in the Helm repository, one of which is known as chartmuseum. The chartmuseum supports all cloud storage backends, and here you can also manage the chart repository as well as organize the charts as per your own comfort. You can use the helm repo-add command to add a new repository to Helm. This will help you access the charts in the Helm repository, and you will be able to use the charts in the deployment process.

The charts are combined into the same package with the help of helm package commands and you can find the chart version by using the name of the version attribute, such as chart.yaml file. After finding an available chart in the Helm repo, the DevOps can make use of it in the process of deploying a new release to the cluster.

Using the helm install command line, you can select a relevant Docker image that is stored in the values.yaml file under the “image” attribute. The command line itself will work in the cluster to help you deploy the application. You can use the helm upgrade –install command to upgrade a service or you can also create a missing service with the command.

Another use of Helm is to perform a rollback after performing a rollout that led to a malfunctioning of the service. If you use the helm rollback command, it will revert to the previous version of the service and restores it. The helm history {RELEASE} command works in the helm revisioning mechanism system that directs Helm to roll back after a malfunctioning rollout.

An Overview of the Helm Charts

Have a look at the basic directory structure of a Helm chart that consists of templates, YAML files, and more.

  • charts/: You can use requirements.yaml command to manually link dependencies of the application. Usually, the chart dependencies of the applications are found in the charts/: directory.
  • templates/: The templates/: directory contains the configuration value of the applications and is placed in the Kubernetes manifests or values.yaml file. These templates use the Go programming language’s template format to organize the configuration values.
  • Chart.yaml: The YAML file is a combination of metadata of a helm chart. This file contains the chart name and version, a relevant website, maintainer information, and search keywords.
  • LICENSE: License is written in a plain text format that is displayed as a verified confirmation page for the chart.
  • README.md: This file contains the information of the chart users.
  • Requirements.yaml: This is a file that is created in the .yaml format to display the chart’s dependencies in a list.
  • values.yaml: This YAML file contains the default configuration values of the Helm chart.

You can use the helm command to install a chart from the .tar.gz packaged version or a local directory. Also, you can download the packaged charts manually or set them to download automatically.

An Overview of Chart Repositories

A Helm chart repository is nothing but a simple HTTP site that delivers an index.yaml file and .tar.gz packaged charts through the helm command. You can use the helm command and many other subcommands to package the charts and, at the same time, create the required index.yaml file. The charts will be available through GitHub Pages, web server, object storage service, or any static service host. The default chart repository of Helm is called stable and is connected to a Google Storage bucket. You can find the source of the stable repo in the helm/charts Git repository on GitHub.

However, if you want to add an alternative repository to the helm, you can do so with the simple helm repo-add command. Here are some of the most popular helm chart repositories:

  • Incubator repo includes helm charts; however, they are not stable. But if you want to use the incubator, you can find the instructions for doing so on the official Helm charts GitHub page.
  • You can find many charts in the Bitnami Helm Charts that are not available in the official stable repo.

You will always have to configure a chart to make it compatible with your Kubernetes application containerization setup. Have a look at the next section to learn how to configure helm charts.

An Overview of Chart Configuration

You will find the values.yaml file of a chart where the default configuration value of the particular chart is stored. You can deploy some applications fully with their default values; however, that is not always the case. To make use of the charts, you will have to reconfigure the values to meet your containerization needs.

The creator or writer of the chart specifies values of their configuration; the ones they used for containerizing their own applications. And the rest are helpful in configuring Kubernetes primitives. Some of those values can be passed through the underlying container that helps in configuring the containerizing application.

Configuration values typically look like this:

service:
  type: ClusterIP
  port: 3306

You can use this option to configure a Kubernetes service resource, or you can use the helm inspect values chart-name to replace the predetermined configuration values of a chart.

You can replace these values with your needed values in the YAML file and run the file during helm install. You can set the options of the configuration values individually or separately on the command prompt with the ‘–set’ flag. However, make sure to specify the correct wanted values of the charts that you want to change from the default values.

What are the Benefits of Helm?

By far, you may now have become well aware of what is helm, how to use it, and what are the different components of helm (charts and charts repositories). However, there are various benefits of the helm that developers find useful for managing and containerizing applications that you should know. Have a look at some of the key benefits of the helm:

  • Boosts Productivity

Writing the YAML file of the software applications takes a lot of time, and most software developers have to do it as it’s a part of their job responsibilities. By using Helm, you take things up to the next level as you can easily combine all the resources of the software into different YAML files. With helm, you can deploy test environments for applications with a few clicks.

For example, there is a new feature in the software that you are deploying. To know if the feature is working fine, you will require a SQL database that will let you know how the feature is working. You can run the Helm Install command on the command prompt to create the databases and tables of the application. This saves time of installing the app locally but still; you can test the new feature through the prepared database.

  • Helm Reduces Duplicate and Complex Data

After building the chart with all the needed information, anyone can use it for any number of times. Therefore, it is saving time and complexity of creating the same chart over and over when needed. You can use the same chart in a different environment for development, testing, and production purposes. Suppose you have created the chart in a Linux system but since the data is there and the data won’t go away unless you erase it, you can use the same chart in a Windows system.

To make sure that the chart is ready to use in a different environment, you can tune the chart.

  • Reduces Time for Learning K8S

The learning curve for Kubernetes containers is steep and requires a significant amount of time and effort on your side. However, with Helm, you can reduce the time to learn operating Kubernetes. You won’t have to understand the detailed functions of every Kubernetes feature to deploy and develop containerized applications by making use of the Helm package manager.

This is because Helm can easily integrate itself into the CI/CD pipelines that let the software developers focus on writing codes for application deployment. But the deployment process will be done by the Helm client itself.

  • Helm Makes Deployment of Applications Easier

You can easily set overridable defaults in the values.yaml file with the help of Helm charts. This will help the software developers as well as the administrators to determine the base settings of an application. As a user of the helm charts, you can override their settings during the installation of the Kubernetes cluster’s charts. You can override them to make them compatible with your requirements. But if your Kubernetes cluster requires the default installation of the charts, you won’t have to override them.

Helm reduces the complexity of deploying applications in Kubernetes by doing most of the work for the developer. You won’t have to learn about all the Kubernetes features individually, but the deployment can still be done effectively.

How to Install Helm?

Installing helm on your system requires binary releases or installer scripts. You can also download the package manager compatible with different operating systems and install it manually on your computer. You can use either of the two ways to install and fetch helm that is described in the Helm project. Or connect with the Helm community to get all the essential help required for installing the helm package manager on your system.

Here are the different ways to install helm:

  • Install Helm From Binary Releases

You can find binary releases of Helm for different operating systems, and you can download those versions to manually install them. Just follow the steps mentioned below:

  1. Download your suitable Helm version from GitHub. Open the downloaded version from the downloads folder, and it will ask you to unpack it.
  2. Unpack it using the (tar -zxvf helm-v3.0.0-linux-amd64.tar.gz) command when prompted.
  3. You will have to find the Helm binary in the unpacked directory and move the binary to your preferred location with this command: (mv linux-amd64/helm /usr/local/bin/helm)
  4. Run the client from the new location and add the stable repo: helm help
  • Install Helm Using Scripts

Helm has an installer script that will help you find the latest version of Helm and install it on your system. You will have to fetch and execute the installer script locally. Read the script before running it to understand what’s happening:

$ 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
  • Installing Helm Using Package Managers

These package managers are not related to the Helm project and are also not widely trusted but you can find them in the Helm community and install them on your operating system. Following are some steps that will guide you with the process:

  1. Use the brew install helm formula to install from Homebrew (for macOS)
  2. Or run the choco install kubernetes-helm command on the command prompt to install from Chocolatey ( for Windows)
  3. For the Ubuntu system, the following commands will work:
curl https://baltocdn.com/helm/signing.asc | sudo apt-key add -
sudo apt-get install apt-transport-https --yes
echo "deb 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

Conclusion

Helm has a popular alternative named kubectl, which serves as a simpler approach to communicating with Kubernetes clusters. Kubectl has all the abilities that Helm comes with, but Helm has more abilities than kubectl when it comes to deployment. You can learn about kubectl from our other articles if you want, but you possibly won’t need it because Helm is the ultimate package manager choice for web developers. Overall, the helm is the best of all package managers for application deployment and management in the Kubernetes cluster.

Leave a Comment