What is a helm chart
Helm uses a packaging format called charts. A chart is a collection of files that describe a related set of Kubernetes resources
In other word the helm chart just a package manager like (linux package manager apt, dnf, yum,zypper) for kubernetes cluster.
With the help of helm chart we can deploy, create, manage, update resources in kubernetes cluster.
Features
Manage Complexity
Charts describe even the most complex apps, provide repeatable application installation, and serve as a single point of authority.
Easy Updates
Take the pain out of updates with in-place upgrades and custom hooks.
Simple Sharing
Charts are easy to version, share, and host on public or private servers.
Rollbacks
Use helm rollback to roll back to an older version of a release with ease.
Install helm chart
Download the helm installer script, Helm installer script automatically fetch the latest verion.
[root@client01 ~]# chmod 700 get_helm.sh
[root@client01 ~]# ./get_helm.sh
From Homebrew (macOS)
From Apt (Debian/Ubuntu)
Apt This package is eventually up to date.
[root@client01 ~]#sudo apt-get install apt-transport-https –yes
[root@client01 ~]#echo “deb [arch=$(dpkg –print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main” | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
[root@client01 ~]#sudo apt-get update
[root@client01 ~]#sudo apt-get install helm
From dnf/yum (fedora)
Since Fedora 35, helm is available on the official repository. You can install helm with invoking:
Verify the helm installation
/usr/local/bin/helm
[root@client01 ~]#helm version
version.BuildInfo{Version:”v3.9.0″, GitCommit:”7ceeda6c585217a19a1131663d8cd1f7d641b2a7″, GitTreeState:”clean”, GoVersion:”go1.17.5″}
Create first helm chart
Creating nodejs
Helm Chart Structure
Chart.yaml
The chart.yaml file has all the metadata regarding created chart
You do not need to define each configuration here but you must need to define –
name
version
values.yaml
This is the configuration file which holds all values of deployment, service account etc..
Here we need to change our nodejs docker image repository url.
repository: nodejs-docker-image-url
pullPolicy: always
# Overrides the image tag whose default is the chart appVersion.
tag: “”
deployment.yaml
This is another configuration file related to our deployment and need to update.
we do not need to update or modify each and every configuration. But we can change and update the containerPort to 3001
service.yaml
The service.yaml is eventually used for exposing our kubernetes nodejs deployment as service. But we do not need to update any configuration here.
Execute helm template nodejs command to know default actual values before executing the helm install command
Execute the helm lint command to confirm possible issues.
==> Linting nodejs
[INFO] Chart.yaml: icon is recommended1 chart(s) linted, 0 chart(s) failed
helm -debug -dry-run
Execute the following -dry-run command to verify our nodejs Helm Chart
If there is something incorrect with our Helm chart configuration then it will going to prompt you immediately.
Install nodejs using helm chart
mynodejsapp : IT is realease name for the chart or application, if leave blank the helm chart assign own release name.
nodejs : Actual name of our chart
Verify the chart installation
mynodejsapp release and update its replicaCount from 1 to 2
let’s modify replica count in value.yaml
[root@client01 ~]#helm upgrade mynodejsapp .
Here we are going to rollback to previous version 1
Rollback Helm release
Delete helm release