You dont have javascript enabled! Please enable it! Mastering Kubernetes Helm: Step-by-Step Guide - CHARBEL NEMNOM - MVP | MCT | CCSP | CISM - Cloud & CyberSecurity

Mastering Kubernetes Helm: Step-by-Step Guide

5 Min. Read

Kubernetes Helm, often referred to as the Kubernetes package manager, is a tool that streamlines the process of installing and managing applications on Kubernetes. You can think of it as the yum/apt/homebrew for Kubernetes.

Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources. It is Helm’s approach to Kubernetes applications, reducing the complexity of deployment and providing a higher level of abstraction.

Helm also supports chart repositories where charts are stored and shared. Helm’s stable public repository is one of the most common repositories, but you can also create private repositories based on your needs.

In this article, we will discuss the key features and the common use cases of Helm, and show you how to get started with Kubernetes Helm.

Key Features of Helm

Helm, a robust package manager for Kubernetes, boasts a range of key features pivotal to simplifying application deployment and management.

Key Features of Helm
Key Features of Helm

Let’s explore the capabilities of this powerful Kubernetes package manager:

Charts

Helm charts are the foundational elements in Helm’s architecture. They serve as the primary packaging format for Kubernetes applications. Each chart is a collection of files that describe a set of Kubernetes resources and their interdependencies. These files typically include resource definitions, configuration files, and metadata about the application.

Charts enable users to define, install, and upgrade even the most complex Kubernetes applications. They can be easily customized for different deployment scenarios, making them ideal for both development and production environments.

Templates

Templates in Helm are YAML files that contain resource definitions with embedded Go language templating commands. These templates allow the dynamic generation of Kubernetes manifest files. Users can input values that modify these templates, enabling the creation of custom Kubernetes configurations from the same chart.

This feature provides significant flexibility, allowing Helm to cater to a wide range of application requirements and environments. By using templates, Helm can standardize application deployment while still allowing for customization based on user-specific needs.

Releases

In Helm, a release is an instance of a chart running in a Kubernetes cluster. When a chart is installed, Helm creates a new release for it. Each release has a unique name and tracks the deployment of a particular version of a chart.

This concept allows Helm to manage multiple deployments of the same chart across different environments. Releases are crucial for Helm’s version control capabilities, enabling users to manage, upgrade, or roll back applications to different states easily.

Rollbacks

Rollbacks are a key feature of Helm, providing a mechanism to revert a release to a previous version in case of a failure or undesired state. This functionality is vital for maintaining application stability and reliability.

In scenarios where an upgrade introduces issues, Helm’s rollback capability allows operators to quickly revert to a known good state, minimizing downtime and impact on services. This feature underscores Helm’s strengths in managing complex application deployments and lifecycle management.

Repositories

Helm repositories are collections of charts stored in a central location, making them accessible to users. They can be public or private, allowing organizations to share charts within their teams or with the broader community.

Repositories play a critical role in Helm’s ecosystem, acting as a library where users can find, share, and reuse application definitions. They support versioning, ensuring that users have access to different versions of charts for various requirements. By using repositories, teams can standardize application deployment across their organization and contribute to the broader Kubernetes community.

Common Use Cases for Helm

Helm is a versatile tool with many use cases. Below are some of the most common ones:

Simplifying Application Deployment

Application deployment can be a complex process, especially when dealing with microservices architecture. Helm simplifies this process by using charts, which package all the Kubernetes resources required for an application. This eliminates the need for manual orchestration, making the deployment process more efficient and error-free.

Managing Application Lifecycles

Helm also excels at managing the lifecycle of an application. It handles upgrades and rollbacks without the need for manual intervention. This is particularly useful in a continuous delivery setup, where changes are frequently pushed to the application.

Customizing Deployments

Helm charts support customization. They can be parameterized using Values files, allowing you to deploy the same chart in different environments with different configurations. This makes Helm a powerful tool for managing deployments across multiple environments like development, staging, and production.

Aggregating Multiple Kubernetes Resources

Helm charts can comprise various Kubernetes resources, including deployments, services, and ingress. This means you can manage all these resources as a single entity. This is particularly useful when deploying complex applications that require multiple resources.

Getting Started with Kubernetes Helm

Beginning the installation of Kubernetes Helm marks a pivotal step in managing and deploying applications within Kubernetes clusters, and it sets the stage for leveraging Helm’s capabilities in orchestrating and managing Kubernetes-native applications effortlessly.

Getting Started with Kubernetes Helm
Getting Started with Kubernetes Helm

Assuming that you already have your Kubernetes cluster up and running and the “kubectl” tool installed on (Linux, macOS, or Windows), take the following steps:

Related: 5 Threats Facing Your Kubernetes Deployments.

Install Helm

Helm can be installed on macOS, Windows, and Linux distributions. The simplest method of installing Helm is to use the script available on the Helm GitHub page, which automatically detects your operating system and downloads the appropriate Helm binary. At the time of this writing, the latest release of Helm is v3.13.3. The next feature is v3.14.0 and will be released on January 17, 2024. You can also use a script to install on any system with “bash“.

Once downloaded, you can verify your Helm installation by running the command “helm version” in your terminal. This will display the version of Helm that is installed on your system.

Install Helm
Install Helm

Create a Helm Chart Repository

After installing Helm, the next step is to create a Helm chart repository. A Helm chart repository is a location where packaged charts can be stored and shared.

To create a Helm chart repository, use the command “helm create NAME“. This command sets up a local Helm chart repository on your system. The “helm show chart” command shows information about a chart. Once created, you can add charts to your repository using the “helm packagecommand.

Create a Helm Chart Repository
Create a Helm Chart Repository

A Helm chart repository can be hosted on a HTTP server or you can use an existing chart repository service like ChartMuseum or JFrog Artifactory. Once your chart repository is set up, you can search for charts in your repository using the “helm search” command. To update your local cache of charts, use the “helm repo update” command.

Install an Example Chart

Now that we have a Helm chart repository, the final step in getting started with Kubernetes Helm is to install an example chart.

Helm provides several example charts that you can use to familiarize yourself with the process. For this guide, we will use the “nginx” chart, which deploys a simple web server.

To install the “nginx-ingress” chart, you need first to add the public “stable” repository to your repositories by running this command “helm repo add stable https://charts.helm.sh/stable --force-update“.

Then use the commandhelm install NAME stable/nginx-ingress“. Helm will create a new deployment in your Kubernetes cluster and print out a set of resources.

Install nginx-ingress chart
Install nginx-ingress chart

You can check the status of your deployment using the “helm status NAME” command.

Verifying the Installation

To verify that your application was deployed correctly, you can use the “kubectl get services” command. This will provide a list of all services running in your Kubernetes cluster, including your newly installed “nginx” service.

Related: 5 kubectl commands everyone should know.

In Conclusion

Getting started with Kubernetes Helm involves a series of steps starting with the installation of Kubernetes, the installation of Helm, initializing a Helm chart repository, and finally installing an example chart. As a Kubernetes package manager, Helm simplifies the deployment and management of applications on a Kubernetes cluster.

From facilitating easy installation and version control of Kubernetes applications through charts to enabling efficient templating for configuration, Helm streamlines the deployment process. Additionally, its repository management, rollback capabilities, and seamless upgrades contribute to Helm’s versatility and effectiveness in managing complex Kubernetes environments. With practice, you will find Helm to be an indispensable tool in your Kubernetes toolkit.

__
Thank you for reading my blog.

If you have any questions or feedback, please leave a comment.

-Charbel Nemnom-

Photo of author
About the Author
Charbel Nemnom
Charbel Nemnom is a Senior Cloud Architect with 21+ years of IT experience. As a Swiss Certified Information Security Manager (ISM), CCSP, CISM, Microsoft MVP, and MCT, he excels in optimizing mission-critical enterprise systems. His extensive practical knowledge spans complex system design, network architecture, business continuity, and cloud security, establishing him as an authoritative and trustworthy expert in the field. Charbel frequently writes about Cloud, Cybersecurity, and IT Certifications.
Previous

Using UEBA to Secure Your Cloud

Step-by-Step – Microsoft Entra Internet Access

Next

Let us know what you think, or ask a question...