The Beginner’s Guide to Helm Charts

In this article, you will be learning about Helm Charts and its relationship with Kubernetes. In definition, Helm Charts works as a package manager for Kubernetes which allows the developers to package, configure, deploy applications into Kubernetes clusters. You will be learning the important concepts of Helms and its common principles and use cases.

This helm charts guide helps you to understand Helm, Helm Charts, How to use Helm Charts, and when to use them. Also, this guide helps you a lot if you are preparing for Certified Kubernetes Administrator (CKA) exam.

What is Helm Chart in Kubernetes ?

Helm helps in the management of Kubernetes applications — helm charts let us define, install, and upgrade even the most complex Kubernetes application.

Since a single Kubernetes application can involve a lot of objects such as deployments, services, configmaps, secrets, etc. – it makes sense to outsource the deployment, rollback, and other management workflows to helm.

In this post, we would go through the theory and then look at the various helm operations on our own chart. Basic understanding of Kubernetes objects is recommended to fully understand this post.

Let’s start with the theory.

Terminologies

There are some terminologies that one must get familiar with before diving in.

Chart

It is a bundle of information necessary to create an instance of a Kubernetes application such as deployment objects, configmaps, service objects etc.

Config

This file contains configuration information that can be merged into a packaged chart to create a releasable object.

Release

It is a running instance of a chart, combined with a specific config.

Helm executables

Helm is an executable that consists of two parts:

Command-line client

The client is used for developing a new chart, managing repositories, managing releases, and communications with the helm library.

Helm library

It contains the logic for executing all operations. It communicates with the Kubernetes API server and takes care of things such as configuring a release, installing charts, upgrading the releases, and performing rollbacks.

Use cases

The reason that it is gaining popularity is the way it can simplify common administration and management workflows.

Let’s look at areas where using it can be beneficial.

Manage Complexity

A chart can describe even the most complex apps, provide repeatable application installation, and serve as a single point of authority. Helm supports all the Kubernetes objects.

Managing Updates

It offers capabilities to perform in-place upgrades and lets us create custom solutions to take the pain out of update processes.

Managing Sharing

Charts are easy to version, share, and host on public or private servers.

Managing Rollbacks

Rollbacks to older versions of a release can be done easily with just a single rollback command.

That’s all the theory one needs to know to get started. Now, let’s see how it is used practically.

Helm pre-requisites

You should have the following before getting started with the helm setup.

  • A Kubernetes cluster. Minikube is fine as well.
  • Cluster API endpoint should be reachable from where helm is being used.
  • Kubectl should be configured with cluster-admin permissions.

Now, let’s install Helm.

Installing Helm

  • Download a shell script from Helm and execute it. The script will install helm on your system. Execute the below commands –
    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
  • Try out the following command to verify the installation –
    helm --help

Creating a chart

  • A simple helm command lets you initialize a sample chart. This gives you a head start for using helm.
    helm create mychart
  • This would initialize a chart with all the components of a chart in a directory – “mychart”.

Take a look at the contents of this directory, you’ll see a lot of sub-directory and files. Let’s learn about these.

Components of a chart

Values.yaml

This contains all the configurations for all the YAMLs.

Chart.yaml

This contains data about the charts like name, version & description.

Templates

This directory contains all the Kubernetes YAMLs.

Subcharts :

Helm lets you create sub-charts, all files relating to sub-charts go in this directory.

Now, let’s see how a helm chart gets deployed.

helm charts dashboard
Dashboard of Helm charts [source: www.dev.to]

How does helm deploy the objects?

  • Helm reads values from values.yaml and writes them on the Kubernetes objects present in the templates directory. The YAMLs present in the templates directory are supposed to have placeholders for values coming from values.yaml file.
  • It then deploys the object.
  • By having all the configurations in a single file values.yaml – it makes the management easy.

Deploying a chart

  • It’s quite simple. Just execute –
    helm install mychart ./mychart
  • To see a list of the helm charts currently deployed –
    helm list

The real value of using a chart is in the ease that it introduces for the upgrade process. Let’s try to update the chart.

In a chart, the values.yaml file contains the configurations. So, in order to make a change, values.yaml needs to be modified.

Upgrading a chart

  • Let’s try to upgrade the chart. For instance, let’s change the replicaCount in values.yaml from 1 to 2.
  • Let’s apply the change now –
    helm upgrade mychart ./mychart

That’s it. It’s that easy!

Helm history

For each upgrade, helm keeps a record of the changes which you made. To see the history –

helm history mychart

One of the biggest reasons to use helm is for easy rollback workflows. Let’s take a look at that now.

Rollbacks

To roll back to a previous revision –

helm rollback mychart <revision number>

That’s all the basics that one needs to get started with helm for their projects.

Summary

Hope you enjoyed reading this article and got to know about Helm charts in detail. Helm is gaining traction and also of teams are looking to adopt it for their product.  Familiarity and skills with helm are good to have and can give you the required edge over the competition. This Hem charts guide covers some of the exam objectives of Kubernetes certification exams. You can explore more about helm at https://helm.sh/. Keep exploring and learning!

About Shishir Khandelwal

Shishir has the passion and zeal to master his field of cloud & containers. He is a strong advocate of finding smart solutions to complex problems by leveraging the power of cloud & container technology such as Kubernetes and a strong believer in learning by doing because of which he does a lot of POCs and personal projects. He is a certified expert in AWS & Kubernetes.

1 thought on “The Beginner’s Guide to Helm Charts”

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top