Simplifying Kubernetes Deployments with Helm Package Manager.

Chanderkant Sharma
CodeX
Published in
5 min readSep 10, 2022

--

Image Credits: iStockPhoto.com

Kubernetes had gained a lot of traction in recent years and it has become the industry's de facto standard to deploy containerized applications. Kubernetes, as a container orchestrator, abstracts out a lot of complexity for you, but application deployment and release management on the Kubernetes cluster become more tedious tasks with your application growth.

We normally use plain Kubernetes manifests — YAML files to deploy our application and its resources to the Kubernetes cluster. And from a version control perspective, we can keep your YAML files in a Git repository but there is no authentic way of versioning them properly. Furthermore, generating manifest files with dynamic configuration options might be critical from a reusability aspect.

This is where Helm shines in. Helm allows you to simply execute a few commands in the terminal and you’re good to go with your Kubernetes deployment!

In this article, we will try to cover Helm's core concepts and how Helm can simplify Kubernetes deployments and release management.

What is Helm?

Helm

Helm is a package manager for application deployment and release management on your Kubernetes cluster. It is similar to APT, YUM, NPM, and YARN package managers. It’s not only a Package Manager for Kubernetes deployment, but it’s also a Kubernetes Deployment/Release Management tool.

Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application. Helm is the best way to find, share, and use software built for Kubernetes. Helm is a graduated project in the CNCF and is maintained by the Helm community. Sources — https://helm.sh/

Helm2 Architecture

Helm 2 is a client-server architecture with the client called helm and the server called Tiller. The client is a CLI that users interact with to perform different operations like install, upgrade, and delete. As seen in the following diagram, the client interacts with Tiller and the chart repository. Tiller interacts with the Kubernetes API server. It renders Helm template files into Kubernetes manifest files, which it uses for operations on the Kubernetes cluster through the Kubernetes API. Sources — developer.ibm.com

Image Credits: developer.ibm.com

Helm3 Architecture

Helm 3 has a client-only architecture with the client still called helm. As seen in the following diagram, it operates similar to the Helm 2 client, but the client interacts directly with the Kubernetes API server. The in-cluster server Tiller is now removed. Sources — developer.ibm.com

Image Credits: developer.ibm.com

Installing Helm

Installing Helm is quite easy. Please refer to the official release page and get the latest Helm release for your specific operating system.

https://helm.sh/docs/intro/install/
https://helm.sh/docs/intro/using_helm/

Helm Charts Creation, Repositories & Deployment Workflow​

Main components of Helm Package Manager…

Helm Chart

A bundle of information is required to create an instance of a Kubernetes application.

Config

It holds information about configuration, which you can merge into a packaged chart for creating a releasable object.

Helm Release

An operational instance of chart united using a specific config.

Helm Chart Repository

A chart repository is an HTTP server that houses an index.YAML file and optionally some packaged charts. When you’re ready to share your charts, the preferred way to do so is by uploading them to a chart repository.

This diagram depicts the high-level workflow for Helm Charts…

Image Credits — hands-on.cloud

Helm Charts

Post Helm installation, to create a helm chart, run the following command…

helm create <Name Of the Chart>
helm create EMP_HELM_CHARTS

Post running this command you’ll get the following folder structure…

  • Top-level EMP_HELM_CHARTS -> folder is the name of the Helm chart
  • Chart.yml -> Metadata information about chart
  • values.YAML -> values for Template file
  • charts -> folder has charts dependencies
  • templates -> folder has the actual template files(YAML files template to create Kubernetes resources like pod, service, etc.)

This diagram depicts the folder structure for Helm Charts…

Helm Repository

We can create your Helm charts or use third-party Helm charts and add them to Helm Repo for later use. Following commands can be used to add charts to the repo, search charts, list charts, update charts and remove charts…

helm repo list
helm repo search <repo_name>
helm repo add <repo_name> <repo_url>
helm repo update
helm repo remove <repo_name>

Upgrades and Rollbacks

Helm release management help to deploy, upgrade and rollback the deployment using these commands:

Helm install <chartname> -f PATH_TO_values.yaml
Helm upgrade <chartname> -f PATH_TO_values.yaml
Helm rollback <chartname> [REVISION]

Helm install command will create Kubernetes resources using dynamic YAML template files and a Helm release with number 1, along with creating the Kubernetes resources.

And upgrade and rollback commands will add/update/delete Kubernetes resources and create subsequent helm releases.

Changes are applied to existing deployment instead of creating a new one and Handling rollback to previous versions.

The same Helm charts can be used for Kubernetes application deployment across different environments by using customizedvalues.yaml .

values.yamlwill be different for the respective environment.

Cleanup Resources

Helm releases include the deletestate in its lifecycle. When you delete a Helm chart, it’ll delete all the resources related to the Helm release.

helm delete my-helm-release

Conclusion

In this article, we have gone through how Helm can simplify Kubernetes deployments and release management.

Helm helps us to abstract configuration out of Kubernetes manifests files and make it more customized. Use of helm charts, it is effortless to set up many stacks like Jenkins, Prometheus, Grafana, etc., on the Kubernetes cluster as compared to the manual deployments done through Kubernetes YAML files.

Overall, when it comes to making Kubernetes deployment seamless and quick, Helm charts can certainly help. Having said that, there are a couple of other Kubernetes package managers as well like kustomize, kapitan, skallfold, etc.. that are equally good.

Here is a sample repo to try out Helm… GitHub Repo

Instructions to use this repo…

Thank you for reading!

--

--

Chanderkant Sharma
CodeX

Passionate technologist helping enterprises with digital transformations initiatives…