26
HELM Cheatsheet: For Beginners
The Helm is a package and operation manager for Kubernetes. Though handling Kubernetes applications and several releases can increase the development and deployment complexities. The Helm as a packaging manager allows you to wrap up all the Kubernetes components within a single package for deployment, thus reducing complexities. You can integrate several Kubernetes objects within the Helm chart, which is deployed as a whole. You can use Helm to deploy a single application or a part of an extensive application.
There are a number of tools that can be used with Helm charts to ease the Kubernetes deployment process. You can also integrate the Helm charts within the CI/CD process to automate each process, giving developers leverage to work on writing codes rather than running and handling production deployments. You can use and install the Helm with one click. Helm comes with the command-line user interface called ‘helm’ to perform the Helm functionalities.
Below are some Helm commands
The above command will provide you information about the available Helm commands.
# helm help
# helm help search
The above command will allow you to search for the charts. You can use helm search as mentioned below.
# helm search phpmyadmin
output-
NAME CHART VERSION APP VERSION DESCRIPTION
stable/phpmyadmin 4.3.5 5.0.1 DEPRECATED phpMyAdmin is an mysql administration frontend
NAME CHART VERSION APP VERSION DESCRIPTION
stable/phpmyadmin 4.3.5 5.0.1 DEPRECATED phpMyAdmin is an mysql administration frontend
With the above command, you can download the chart locally without installing it. You can use the chart name with the fetch command to download all the charts and template files within the directory.
# helm fetch stable/phpmyadmin
# ls -ltr
# ls -ltr
output-
Total 32
-rw-r--r-- 1 root root 28921 Jun 29 11:04 phpmyadmin-4.3.5.tgz
Total 32
-rw-r--r-- 1 root root 28921 Jun 29 11:04 phpmyadmin-4.3.5.tgz
Using the above command, you can easily install the chart followed by the chart name. You can use the ‘- name’ option if you want to name the deploy chart and ‘- version’ to specify the chart version as per your requirement.
# helm install stable/phpmyadmin --name myphpadmin --version 4.3.3
The above command will provide the deployed resources overview, which can be checked from the Kubernetes with the below command.
# kubectl get all |grep -i myphpadmin
You can use the above command to initialize the helm.
You can check the chart installation status using the above command. You have to provide the chart name about which you want the status.
# helm status myphpadmin
You can use the list command with complete details of the currently deployed chart.
# helm list
output-
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
myphpadmin 1 Mon Jun 29 11:35:32 2020 DEPLOYED phpmyadmin-4.3.3 5.0.1 default
NAME REVISION UPDATED STATUS CHART APP VERSION NAMESPACE
myphpadmin 1 Mon Jun 29 11:35:32 2020 DEPLOYED phpmyadmin-4.3.3 5.0.1 default
With the help of the upgrade command, you can upgrade the chart version. In the above examples, we have version 4.3.3, and now we are upgrading it to 4.3.4 using the below command.
# helm upgrade myphpadmin stable/phpmyadmin --version 4.3.4
With the above command’s help, you can check the installed chart’s history followed by the chart name.
# helm history myphpadmin
output-
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Mon Jun 29 11:35:32 2020 SUPERSEDED phpmyadmin-4.3.3 5.0.1 Install complete
2 Mon Jun 29 11:53:48 2020 DEPLOYED phpmyadmin-4.3.4 5.0.1 Upgrade complete
1 Mon Jun 29 11:35:32 2020 SUPERSEDED phpmyadmin-4.3.3 5.0.1 Install complete
2 Mon Jun 29 11:53:48 2020 DEPLOYED phpmyadmin-4.3.4 5.0.1 Upgrade complete
You can use the rollback command if you want to move to the previous version of the helm chart. You have to mention the version number with the command as mentioned below.
# helm rollback myphpadmin 1
Rollback was a success.
Rollback was a success.
You can delete the helm chart using the delete command as mentioned below.
# helm delete myphpadmin
release "myphpadmin" deleted
release "myphpadmin" deleted
With the help of the above command, you can list down the repositories used currently.
# helm repo list
output-
NAME URL
stable https://kubernetes-charts.storage.googleapis.com
local http://127.0.0.1:8879/charts
NAME URL
stable https://kubernetes-charts.storage.googleapis.com
local http://127.0.0.1:8879/charts
# helm repo update
output-
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
Update Complete.
Hang tight while we grab the latest from your chart repositories...
...Skip local chart repository
...Successfully got an update from the "stable" chart repository
Update Complete.
You can use the reset command to uninstall the tiller component and the ‘-remove-helm-home’ option after the remove command to remove the helm’s home directory. You can use the ‘-f’ option to remove it forcefully.
# helm reset -f --remove-helm-home
output-
Deleting /root/.helm
Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.
Deleting /root/.helm
Tiller (the Helm server-side component) has been uninstalled from your Kubernetes Cluster.
# helm create
overriding helm values
helm install --name --values config.yaml --timeout 300 --wait stable/mysql
Setting environment variable on creating release
helm install --set x=somevalue -f config.yaml --name
To check the syntax of the helm chart
helm lint
helm lint
To upgrade the chart or variables in a release
helm upgrade --values config.yaml
To inspect the chart details along with the chart name.
helm inspect
To inspect the values assigned in the chart along with the chart name.
helm inspect values
To create package as a .tgz file [if you have chartmuseum]
_helm package _
_helm package . _
To install chart dependencies
helm dep up _
_helm dependency update
26