Demystifying HELM: A Beginner's Guide to Kubernetes Package Management
Tags: helm, kubernetes, docker, devops
Published: 2023-11-14 10:25:00


![HELM_K8s](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ys572dee894zndo98hcj.png)


## 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](https://github.com/helm/helm/releases). 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](Link) - In Progress
[Create Azure Kubernetes Cluster](Link) - 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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l13knamofoi48henoq7r.png)


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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kg8xo6c0udt49mx9dg1x.png)


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/ 
```


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 
```

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/
```

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
```

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](https://helm.sh/docs/)
2. [Helm GitHub Repository](https://github.com/helm/helm)
3. [Helm Charts Repository](https://artifacthub.io/packages/search?kind=0)
4. [Helm Best Practices](https://helm.sh/docs/topics/chart_best_practices/)