Getting started with Helm

Helm Icon

Applications = Collections of code + Tons of configuration.

Applications can be installed from the source code, but we as a users want to install them simply & consistently. And that’s where package managers comes into the picture. One such package manager tool is Helm.

Q. What is Helm ?
A. Helm is a package manager & application management tool for K8s.

Q. What is a Helm Chart ?
A
. A Helm Chart is a helm package. It contains all of the resource definitions necessary to run an application, tool or service inside of a Kubernetes cluster.

Note : Consider helm chart as a single logical deployment unit containing multiple K8s resources packaged together.

Q. Why do we need Helm ?
A
. Well, creating and maintaining K8 yaml manifests for K8 objects is time consuming and tedious task. Helm helps us simplify the process by creating a single package i.e. chart, that can be deployed to our cluster.

Helm helps us to :

  1. Boost developer productivity
  2. Simplify deployments
  3. Enhance operational readiness
  4. Speed up the adoption of cloud native applications
  5. Streamline comfort in leveraging K8s

Q. How to verify the Helm version ?
A. Run either of the below commands to verify hem version.

$ helm version
$ helm version —short

Q. What is a Helm Repository ?
A. Helm Repository is the place where helm charts can be collected & shared.

Distributed community Helm chart repository is located at Artifact Hub.

Helm also provides the flexibility to create & run our own chart repository with multiple storage options :

  • Cloud Buckets
  • Local Storage
  • Git Hub Pages
  • ChartMuseum

Q. How to configure/add a Chart Repository ?
A.Chart repositories are similar to apt/yum repositories.

Download the stable repository by running below command :

$ helm repo add stable https://charts.helm.sh/stable

Q. How to list down all the repositories ?
A.To list down all the repo, Run below command :

$ helm repo list

Q. How to search a repository ?
A.To list down all the repo, Run below command :

$ helm search repo stable

Q. How to search for charts in artifact hub instance ?
A.To search for charts in artifact hub or your own hub instance, Run :

$ helm search hub

Q. How to get helm client environment information ?
A.To retrieve helm client environment information, Run :

$ helm env

Q. How to create a helm chart ?
A. The create a chart named demo-helm-chart, Run :

$ helm create demo-helm-chart

Output : Creating demo-helm-chart

Inside of the directory demo-helm-chart, Helm will expect a structure that matches this :

demo-helm-chart file structure

Explanation : Let’s understand the helm chart structure and about the corresponding files.

Chart.yaml : Yaml file containing metadata info about the chart.charts     : Folder holding any charts upon which this chart dependstemplates  : Folder containing K8s manifest files. NOTES.txt. : A plain text file containing short usage notes.helpers.tpl : _helpers.tpl is used to define Go template helpers. hpa.yaml : Horizontal pod autoscaler yamlvalues.yaml : Default configuration values for this chart

Q. How to update helm’s local charts list ?
A. Chart repositories keeps changing due to frequent updates & new additions. To update helm’s local chart list, Run :

$ helm repo update

Output looks something similar to :

Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈

Q. How to deploy nginx standalone web server with Helm ?
A. Steps to deploy nginx standalone web server with helm :

Update the chart repository.

1. $ helm repo update 

Search the repo for nginx specific charts

2. $ helm search repo nginx

Repo search lists down multiple charts from the default Helm Chart repository, But the nginx standalone web server is available via Bitnami Chart Repository

So, we need to add the Bitnami Chart repo to our local charts list.

3. helm repo add bitnami https://charts.bitnami.com/bitnamiOutput : "bitnami" has been added to your repositories

Now, we can search all the Bitnami Charts via running :

4. helm search repo bitnamiOutput : NAME                                    CHART VERSION   APP VERSION             DESCRIPTIONbitnami/bitnami-common            0.0.9         0.0.9         DEPRECATED Chart with custom templates used in ...bitnami/airflow                   8.0.2         2.0.0         Apache Airflow is a platform to programmaticall...

Now, We can search the Bitnami repo, for nginx by running :

5. helm search repo bitnami/nginxOutput : NAME                             CHART VERSION APP VERSION DESCRIPTIONbitnami/nginx                    8.5.3         1.19.6      Chart for the nginx serverbitnami/nginx-ingress-controller 7.4.2         0.43.0      Chart for the nginx Ingress controller

Now, Let’s install the bitnami/nginx chart. I have specified the name my-web-server for the Kubernetes deployment.

6. helm install my-web-server bitnami/nginx

Output : It contains info about deployment status, revision, namespace, etc and looks something similar to :

To view the created K8s services, pods and deployments, Run:

7. kubectl get svc,po,deploy

To get completer details regarding this Service, Run:

8. kubectl get service my-web-server-nginx -o wide

We see that the created service doesn’t have an external IP assigned to it.

Let’s run below command to assign External IP to the my-web-server-nginx K8s service, so that we can access it over Internet.

9. kubectl patch svc my-web-server-nginx -p '{"spec":{"externalIPs":["192.168.0.194"]}}'Output : service/my-web-server-nginx patched

Let’s describe our service to find out what changed

Cheers! Kubernetes External IPs are now assigned .

Copy the value for EXTERNAL-IP paste it in a new tab in your web browser.

When the Service does come online, you should see a welcome screen similar to :

nginx welcome screen

Congratulations! You’ve successfully deployed the nginx standalone web server using helm.

Note If you don’t want to assign External IP’s to your service and yet want to test out, You can use port forward.

10. kubectl port-forward service/my-web-server-nginx 8888:80

Welcome screen should come up as soon as you hit : http://localhost:8080

Q. How to remove all the objects that helm chart created ?
A. Using Helm uninstall

$ helm uninstall my-web-serverOutput : release "my-web-server" uninstalled

Q. How to package a helm chart and share with the community ?
A. To share the helm charts with the community we use Helm Package.

$ helm package ./demo-helm-chart     
Successfully packaged chart and saved it to:
/Users/amit/myhelmchart/demo-helm-chart-0.1.0.tgz

Helm Commands : Refer to the below link to explore more helm commands.

Helm Release : Helm v3.5.2 is the latest security (patch) release. Users are strongly recommended to update to this release as it fixes two security issues.

Conclusion :

Helm is a graduated project in the CNCF and is maintained by the Helm community. It grows, gets better and becomes more powerful with every release, making our lives easier while working with K8s. I have tried my best to cover the basics, but I guess that’s not enough and there is lot more to cover which I am working on and would come up with shortly.

Let me know if you enjoyed this article by hitting the applause button or leaving a comment/feeback below, it would mean a lot.

Let Helm together! Cheers.

Cloud Native Java - Full Stack Developer | https://www.linkedin.com/in/mnpaa/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store