HELM Cheatsheet: For Beginners
Tags: kubernetes, javascript, webdev, programming
Published: 2021-12-31 06:01:25

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**

- helm help command

The above command will provide you information about the available Helm commands.

_# helm help_

- If you want any details about the Helm command, you can use the helm help <command> below.

_# helm help search_

- helm search command

The above command will allow you to search for the charts. You can use helm search <chart_name> 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

- helm fetch command

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_

output- 
Total 32
-rw-r--r-- 1 root root 28921 Jun 29 11:04 phpmyadmin-4.3.5.tgz
#

- helm install command

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_

- helm init command

You can use the above command to initialize the helm.

- helm status command

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_

- helm list command

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

- helm upgrade command

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_

- helm history command

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

- helm rollback command

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.

- helm delete command

You can delete the helm chart using the delete command as mentioned below.

_# helm delete myphpadmin_
release "myphpadmin" deleted

- helm repo list command

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

- helm repo update command
With the help of the above command, you can update the repositories.

_# 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.

- helm reset command

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.

- Chart installation and manipulation command

1. Creating chart template
The above command will allow you to create the chart template with the <chart_name>.

_# helm create <chart-name>_

2. overriding helm values
_helm install --name <release-name> --values config.yaml --timeout 300 --wait stable/mysql_

3. Setting environment variable on creating release
_helm install --set x=somevalue -f config.yaml <chart-name> --name <release-name>_

4. To check the syntax of the helm chart 
_helm lint_
_helm lint <path-name>_

5. To upgrade the chart or variables in a release
_helm upgrade --values config.yaml <release-name> <chart-name>_

6. To inspect the chart details along with the chart name.
_helm inspect <chart-name>_

7. To inspect the values assigned in the chart along with the chart name.
_helm inspect values <chart-name>_

8. To create package as a .tgz file [if you have chartmuseum] 
_helm package <chart-path> _
_helm package . _

9. To install chart dependencies 
_helm dep up <chart-name> _
_helm dependency update_