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?
- Docker needs to be installed on the machine.
- 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.
- Kubernetes command line tool - kubectl
- Helm Installed. How to install helm
- 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:
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
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. Read more here link here
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:
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):
And the result give:
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 and Twitter.
Top comments (0)