What the hell is Helm? A beginner's guide

Deploy
Hana Khelifa
7 min read

Have you ever been confused about how to deploy applications to Kubernetes? That's where Helm comes in! Helm is a package manager for Kubernetes that simplifies the deployment and management of applications. By using Helm, you can package all the Kubernetes resources required to run an application into a single chart, making it easy to deploy and manage applications across different environments. In this article, we'll explain the basics of Helm, including what it is, how it works, and share a few great practices to get you started on your first Helm chart.

Why Use Helm?

Let's say you have an application that consists of multiple Kubernetes resources, such as deployments, services, and config maps. Without Helm, you would need to manually create and manage each of these resources, which can be time-consuming and error-prone. With Helm, you can package all these resources into a single chart and deploy it with a single command. This not only saves time but also ensures consistency and reproducibility across different environments. Plus, Helm charts can be shared and reused, which makes it easy to deploy the same application to multiple clusters.

What is a chart?

Helm chart is a package that contains all the Kubernetes resources required to run an application, including deployments, services, and config maps, among others. The chart is organized into a directory structure that includes a few key files:

Chart.yaml: Contains the metadata for the chart, such as the chart name, version, and description.
values.yaml: Contains the default configuration values for the chart.
templates/: Contains the Kubernetes resource definitions for the chart, written in YAML or JSON.
Think of a Helm chart as a recipe for deploying your application. The chart includes a list of ingredients (Kubernetes resources), instructions on how to prepare the ingredients (configuration), and a serving suggestion (the release name). By packaging all the resources required to run an application into a single chart, Helm makes it easy to deploy and manage complex applications on Kubernetes.

Helm Architecture

Helm consists of two main components: the helm CLI and Tiller. The helm CLI is a command-line tool that you use to interact with Helm. Tiller is a server-side component that is responsible for deploying and managing the resources in a chart on your Kubernetes cluster.

Main Template of a Helm Chart

A Helm chart is organized into a directory structure with a few key files. Here is an example of the main template for a Helm chart:

mychart/
Chart.yaml
values.yaml
templates/
deployment.yaml
service.yaml

The Chart.yaml file contains the metadata for the chart, such as the chart name, version, and description. The values.yaml file contains the default configuration values for the chart. The templates/ directory contains the Kubernetes resource definitions for the chart, written in YAML or JSON.

Best practices to create your first Helm Chart

Keep your charts small and focused: Each chart should contain resources for a single microservice or application component. This makes it easier to manage and update charts, and helps prevent dependency issues.

Use values to configure charts: Helm provides a way to use values to configure a chart, which makes it easy to deploy the same chart to different environments with different configurations. It's a good idea to define default values in your values.yaml file and override them as needed.

Version your charts: Use semantic versioning to version your charts, to ensure that deployments are consistent across environments. This is especially important when deploying multiple charts that depend on each other.

Test your charts: Validate your charts using a tool like Helm's built-in lint command or an external tool like Chart Testing. This helps ensure that your charts are well-formed and will work as expected when deployed.

Use GitOps to manage charts: Use GitOps to manage your Helm charts and track changes to your Kubernetes resources over time. This makes it easier to roll back changes and maintain a consistent history of your deployments.

Troubleshooting Helm deployments

Despite being an efficient tool, issues can still arise when deploying Helm charts. Here are some troubleshooting tips and commands to help diagnose issues with your deployments:

helm status: Shows the status of a release.
helm list: Lists all the releases on the cluster.
helm rollback: Rolls back a release to a previous version.
helm delete: Deletes a release.
If you encounter issues with your deployments, make sure to check the logs for Tiller and the Kubernetes API server for errors.

Final thoughts

Helm is a powerful tool for managing Kubernetes applications that can help streamline your deployment process. By packaging up all the resources needed to run an application into a single chart, Helm makes it easy to deploy and manage complex applications on Kubernetes. With the tips and examples provided in this article, you should be well on your way to becoming a Helm expert. Happy charting!

Share on
Other articles about:

Recommended articles