Demystifying HELM: A Beginner's Guide to Kubernetes Package Management

raghureddycloud

Raghu Reddy

Posted on November 14, 2023

Demystifying HELM: A Beginner's Guide to Kubernetes Package Management

HELM_K8s

What is Helm?

Kubernetes(k8s) is an open-source platform that automates the deployment, scaling, and management of containerized applications. However, managing complex applications within Kubernetes can be challenging. This is where Helm comes in. Helm is a powerful package manager for Kubernetes, providing a streamlined way to define, install, and upgrade even the most intricate Kubernetes applications through the use of charts.


Helm is a graduated project in the CNCF and is maintained by the Helm community.

How to Install Helm

Installing Helm is a straightforward process. You can download the binary for your specific operating system from the official Helm GitHub repository. Once downloaded, follow the platform-specific installation instructions provided in the documentation.
https://helm.sh/docs/intro/install/

Why Use Helm?

Helm significantly eases the deployment process on Kubernetes by allowing you to define, install, and upgrade even the most complex Kubernetes applications. It promotes consistency and repeatability in the deployment process, making it an invaluable tool for managing Kubernetes clusters.

Pre-requisites

Before you begin using Helm, ensure that you have a running Kubernetes cluster. Additionally, you should have basic knowledge of Kubernetes concepts, such as pods, deployments, and services, to effectively utilize Helm for managing your applications.

Key Components

Charts

Charts are Helm packages that contain pre-configured Kubernetes resources necessary to run a specific application.

Releases

Releases are instances of a chart running in a Kubernetes cluster. Each release has a unique release name that is used to identify the deployed resources.

Repositories

Helm repositories store and distribute charts. They can be public or private, allowing users to share and discover Kubernetes applications easily.

Pre-requisite (We need kubernetes cluster)

Create AWS EKS Cluster - In Progress
Create Azure Kubernetes Cluster - In Progress

Creating a Sample Nginx Helm Chart and Testing It

We will try deploying nginx on k8s cluster.

To create a sample Nginx Helm chart, you can use the Helm CLI. First, use the helm create command to generate the basic directory structure for the chart.

$ > helm create nginx-demo

Creating nginx-demo

You can check the content of the folder that got created.

ls -ltr

We will try to inspect the structure and it's content inside.

The first two files you see—Chart.yaml and values.yaml—define what the chart is and what values will be in it at deployment

We have values.yaml, in that all the values for nginx deployment can be configured. Declared variables to be passed into your templates at run time.
For example, we have below reference values.yaml file.

Nginx Values

After making the necessary changes, use the helm install command to deploy the Nginx chart to your Kubernetes cluster.
Syntax and Example
helm install <release name> ./nginx-demo

$ > helm install nginx-dev-rel ./nginx-demo
NAME: nginx-dev-rel
LAST DEPLOYED: Tue Nov  14 15:35:09 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  http://chart-example.local/ 
Enter fullscreen mode Exit fullscreen mode

This command lists all of the releases for a specified namespace
helm list

 $ >  helm list
NAME        NAMESPACE   REVISION    UPDATED                                 STATUS      CHART               APP VERSION
nginx-dev   default     1           2023-11-14 15:35:09.214273 +0530 IST    deployed    nginx-demo-0.1.0    1.16.0 
Enter fullscreen mode Exit fullscreen mode

To display the status of the named release,
Syntax and Example
helm status <release name>

$ > helm status nginx-dev-rel
NAME: nginx-dev-rel
LAST DEPLOYED: Tue Nov  14 15:35:09 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
  http://chart-example.local/
Enter fullscreen mode Exit fullscreen mode

Accessing Application

$ > export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=nginx-chart,app.kubernetes.io/instance=nginx-demo" -o jsonpath="{.items[0].metadata.name}")
$ > kubectl port-forward $POD_NAME 8080:80
Forwarding from 127.0.0.1:8080 -> 80
Forwarding from [::1]:8080 -> 80
Enter fullscreen mode Exit fullscreen mode

Visit http://127.0.0.1:8080 to use your application

Happy Helming. You have deployed Nginx using HELM


Best Practices

  • Version your Helm charts to ensure consistency and traceability.
  • Use values files to manage configuration and make your Helm charts configurable.
  • Test your Helm charts thoroughly in a staging environment before deploying them to production.

Reference Links

  1. Official Helm Documentation
  2. Helm GitHub Repository
  3. Helm Charts Repository
  4. Helm Best Practices
💖 💪 🙅 🚩
raghureddycloud
Raghu Reddy

Posted on November 14, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related