Working with Helm: Package Manager for Kubernetes
Tags: helm, kubernetes, devops, docker
Published: 2022-12-31 08:14:03

Helm is an open-source package manager for Kubernetes, a popular platform for deploying and managing containerized applications. Helm charts are packages of pre-configured Kubernetes resources that can be easily deployed to a cluster using the Helm command-line interface (CLI).

In this blog post, we will deploy and delete several Kubernetes resources using just a single command. We will create a helm chart, and deploy an application with front-end, backend and a database on our Kubernetes cluster using a helm chart.

Fundamental knowledge of Docker and Kubernetes is required to follow along.

###What is needed? 
1. [Docker](https://docs.docker.com/engine/install/ubuntu/) needs to be installed on the machine. 
2. A Kubernetes cluster to deploy our application. I am using [Microk8s](https://garywoodfine.com/getting-started-with-microk8s-on-unbuntu/) as my cluster. However, you can use Minikube or k3s for this same purpose.
3. Kubernetes command line tool - [kubectl](https://kubernetes.io/docs/reference/kubectl/)
4. Helm Installed. [How to install helm](https://helm.sh/docs/intro/install/)
5. A sample application: Voting App with front end and backend that shows results on the results page. The voting application only accepts one vote per client browser. It does not register additional votes if a client has already submitted a vote. [Code source](https://github.com/dockersamples/example-voting-app/tree/main/k8s-specifications)

###Application Architecture:

![Application Architecture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ppshmowqhuj37ppjhghe.png)
With the setup above established, lets get our hands dirty.

Docker can be installed by following the steps in this [referenced document](https://docs.docker.com/engine/install/) for specific devices.
```
sudo snap install docker
docker version
```
Next, we are going to install and check the version of Kubernetes installed on the device. 
```
sudo snap install microk8s --classic
kubectl version
```
I have configured a single node kubernetes cluster using [Microk8s](https://garywoodfine.com/getting-started-with-microk8s-on-unbuntu/). Read more here [link here] (https://garywoodfine.com/getting-started-with-microk8s-on-unbuntu/)

Next, ensure helm is installed and check its version:
```
sudo snap install helm --classic
helm version
```

Let's install tree:
```
sudo snap install tree
```
To view tree structure run the command below:
```
tree
```
Let's clone the repository that contains the application configuration files and change directory to this repository:
```
#clone the github repository.
git clone https://github.com/paschalogu/DevOps-Task.git

#change directory
cd Devops-Task

#view the directory tree
tree .
```
Let's check our configuration:
```
helm lint
```
Let's install our application into the cluster. This involves running the command `helm install releasename path`. As we are currently inside our repository, we will replace the path with a dot `.`.

```
helm install myvotingapp .
```
In the command above, myvotingapp is the release name for our helm installation and `.` represents our current location.

```
helm list -a
kubectl get deployment
kubectl get pod
kubectl get svc
```
If everything goes well, you should see the image below:

![kubectl get pod, deployment](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y5iijivgk40vyg760bil.png)

The good part is viewing your application on the browser. Now that our voter application is running. Let's check the browser with our cluster-ip:(port):

![Voting App](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ub2vpeqy0ho4l2euinmm.png)

And the result give:

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

Hence, we have been able to deploy our full application which consists of a front-end, backend, database, etc by just running one command `helm install myvotingapp .`

To delete the entire installation, run the single line of command.
```
helm delete myvotingapp .
```

###Conclusion
Through this blog, we were able to install a full application with a frontend, backend and database with a single line of command.

Thanks for reading. Let me know if you found this helpful.
You are welcome to follow me on [LinkedIn](https://www.linkedin.com/in/paschal-ogu/) and [Twitter](https://twitter.com/Paschal_ik).