DEV Community

Cover image for Working with Helm: Package Manager for Kubernetes
Paschal Ogu
Paschal Ogu

Posted on • Originally published at paschalogu.notion.site

Working with Helm: Package Manager for Kubernetes

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 needs to be installed on the machine.
  2. A Kubernetes cluster to deploy our application. I am using Microk8s as my cluster. However, you can use Minikube or k3s for this same purpose.
  3. Kubernetes command line tool - kubectl
  4. Helm Installed. How to install helm
  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

Application Architecture:

Application Architecture
With the setup above established, lets get our hands dirty.

Docker can be installed by following the steps in this referenced document for specific devices.

sudo snap install docker
docker version
Enter fullscreen mode Exit fullscreen mode

Next, we are going to install and check the version of Kubernetes installed on the device.

sudo snap install microk8s --classic
kubectl version
Enter fullscreen mode Exit fullscreen mode

I have configured a single node kubernetes cluster using Microk8s. Read more here link here

Next, ensure helm is installed and check its version:

sudo snap install helm --classic
helm version
Enter fullscreen mode Exit fullscreen mode

Let's install tree:

sudo snap install tree
Enter fullscreen mode Exit fullscreen mode

To view tree structure run the command below:

tree
Enter fullscreen mode Exit fullscreen mode

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 .
Enter fullscreen mode Exit fullscreen mode

Let's check our configuration:

helm lint
Enter fullscreen mode Exit fullscreen mode

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 .
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

If everything goes well, you should see the image below:

kubectl get pod, deployment

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

And the result give:

Result

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 .
Enter fullscreen mode Exit fullscreen mode

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 and Twitter.

Top comments (0)