Helm is a deployment tool that simplifies installing, configuring, and managing Kubernetes clusters. Anyone familiar with writing Kubernetes manifests knows how tedious it is to create multiple manifest files using YAML. Even the most basic application has at least 3 manifest files. As the cluster grows, the more unwieldy the configuration becomes. Helm is one of the most useful tools in a developer’s tool belt for managing Kubernetes clusters. This article explores Helm’s basic features to give you an idea of how you might use it to help with your Kubernetes deployments.
Introduction to Helm
Helm is a package manager for Kubernetes applications that includes templating and lifecycle management functionality. It is essentially a package manager for Kubernetes manifests (such as Deployments, ConfigMaps, Services, etc.) that are grouped into charts. A chart is just a template for creating and deploying applications on Kubernetes using Helm. Charts are written in YAML and contain metadata about each resource in your app (e.g., labels, values, etc.). A chart can be used by itself or combined with other charts into composite charts which can be used as templates for creating new applications or modifying existing ones. Helm essentially allows you to manage one chart for your environment.
The Helm uses a client/server architecture that consists of the following components:
- Helm Client: The client is the user interface to Helm. It is used to create new charts, manage repositories, and release packages. The Helm client can be installed on both macOS and Linux. It is also available as a Chrome extension. Developers also use help to test upgrades before releasing them into production.
- Helm Library: Helm library is a set of client libraries that are used by the clients to interact with the Kubernetes API server to install, upgrade, or roll back charts. The tool is installed on every node in the cluster and is a required component for installing any chart.
What Are Helm Charts?
Chart is the packaging format used by Helm, it contains the specs that define the Kubernetes objects that the application consists of, such as YAML files and templates, which convert into Kubernetes manifest files. Charts are reusable across environments. This reduces complexity and minimizes duplicates across configurations. There are three basic concepts to Helm charts:
- Chart: A Helm chart is a pre-configured template for provisioning Kubernetes resources
- Release: A release represents a chart that has been deployed
- Repository: A repository is a public or private location for storing charts
When working with Helm, developers search repositories for charts. They install the charts onto Kubernetes clusters, which creates a release.
Helm Chart Structure
The files and directories of a Helm chart each have a specific function:
Charts: The charts directory contains other charts the main chart depends on. A single chart could depend on several charts. Thus, there might be multiple charts in this directory.
Templates: This folder stores the manifest being deployed with the chart. For example, you may be deploying an application that needs a service, a config map, and secrets. In this case, the directory would contain a deployment.yaml, service.yaml, config.yaml, and a secrets.yaml. Each of these files would get its values from the values.yaml file.
Chart.yaml: This file holds meta information such as the version, name, search keywords, etc.
Values.yaml: Default configuration values for the chart.
Benefits of Using Helm
Developers and DevOps teams appreciate Helm’s ability to automate complex Kubernetes deployments. The tool frees them up to focus on more value-added tasks. The tool is very user-friendly which means you don’t need special skills or knowledge to use it. The user interface is intuitive which means you can manage your cluster deployments with ease.
Strong Security Model
It is a very secure solution that makes sure that you can only install packages in your cluster that you trust.
It is a very flexible and customizable solution that makes it easy for you to install different packages on your Kubernetes cluster.
Large Package Ecosystem
It has a very large ecosystem of packages which makes sure that you can find the package that you are looking for.
Helm is an open-source tool that has a large community of developers to support it. That means there’s plenty of support and advice if you run into challenges.
Helm Simplifies Deployments
Helm Charts provide the ability to provision Kubernetes resources with the “click of a button” (or via a command if using the command line interface). Additionally, the tool enables developers to perform complex deployments by including charts as dependencies within other charts.
Keeping track of versions across deployments can be a challenge. Helm automatically handles this task. The tool keeps a database of all release versions. That way, if something goes wrong, the developer can simply roll back to the previous version.
DevOps engineers enjoy the tool’s seamless integration with the CI/CD pipeline. Helm provides integration hooks that can be configured to perform certain actions. For example, these hooks can be configured to act before installation begins or after installation. These hooks can also be used to run health checks on the Helm deployments and verify if the deployment was successful.
Helm Boosts Developer Productivity
As we mentioned, helm charts can be shared. These templates mean you won’t need to spend time rewriting manifests for common tasks. You can also use them to quickly generate a new chart based on one of your existing templates. For example, if you wanted to generate a new Kubernetes application with a specific service account, you can do this with a single line of code. This makes it easier for your team to scale with Kubernetes, as you won’t need to rewrite manifests to handle the same tasks.
Helm Smooths the Kubernetes Learning Curve
Kubernetes is a complex tool with many features and configuration options. The learning curve can be overwhelming. Using Helm removes the complexity and makes Kubernetes more approachable. You can begin using Helm with a single command to install a chart. It also has a user-friendly graphical interface. You can search for charts in the public repository to find one that meets your needs. There are also private repositories where your company’s engineers can upload their charts for other employees to install. Where other tools may require configuration files, Helm uses a declarative approach. You can specify all of your desired settings in a single file, and then install the chart. With Helm, you can also set up automated updates and deployment schedules to keep your cluster up to date with the latest software.
Application Configuration During Deployment
Another distinguishing feature is the ability to provide application configuration during deployment. Not only can you specify the Kubernetes resources (deployments, services, etc.) that make up your application, but also environment-specific configuration for those resources. This allows the same Helm chart to be used across all of your environments.
Creating a Basic Helm Chart
To create a Helm chart, you first need to create a directory where the chart will live. Then you can create the Helm file in that directory. The following example shows how to create a Helm chart that deploys an application to a Kubernetes cluster.
# mkdir my-app
# cd my-app
# helm init
# helm install --name my-app kubernetes/my-app
The –name flag tells Helm which name to give the chart when it is installed. The next step is to configure the Helm chart. You do this by creating a file called config/helm/my-app.yaml in the same directory as the Helm file. The following example shows how to configure the my-app chart to deploy an application named hello world.
app: hello world
app: hello world
- containerPort : 80
The first line in the example sets the API version for the my-app object to apps/v1beta1. The next line sets the kind of chart to be a Deployment. The metadata for the my-app chart will be stored in the file config/helm/my-app.yaml.
The labels field in this file will contain the name of the application that is being deployed. The spec field will contain the configuration for the application. In this case, there is only one container that will be deployed, and it will have port 80 open on it. The last line in this file sets up the template for the my-app chart. This template tells Helm how to create and deploy the application.
To run the my-app chart, you can use the helm command.
# helm list
# helm deploy my-app
The first command lists all of the charts that are currently installed on your system. The second command deploys the my-app chart to a Kubernetes cluster. Helm provides developers with an elegant way of packaging and deploying applications in a Kubernetes cluster. LogicMonitor gives you visibility into networks, cloud, applications, servers, log data, and more within one unified platform. The platform does the hard work for you with automated alert thresholds, AI-powered early warning capabilities, customizable escalation chains, workflows, and more. Get a 14-day free trial to explore for yourself.