Helm is a package manager for Kubernetes that provides resources ready to add and use. It’s like an Apt made specifically for Kubernetes, with multiple repositories of libraries. In this article, we will cover how to init and create a chart that will be available for use.
Building Charts with Helm
The core of Helm is a package called Chart. It contains the definitions to run an application inside Kubernetes. Chart is installed by Helm in Kubernetes, and even though the name suggests a graph tool, that is not what Chart is. It works as recipes—or a formula that specifies how a tool will be installed and configured, and Helm has a repository of charts that can be installed into Kubernetes.
This tool works with the client-server architecture and can be run on Linux operating systems including 32-bit and MacOS. With the installation at both ends, Helm connected to clients and servers creates the graphics required for the management of the Kubernetes application. This makes everything easier. You can have complete control of the application, from deployment to removal of that deployment. As previously mentioned, Helm works with the client-server architecture, and the portion of the server called Tiller will handle the data sent by Helm. Tiller will be in the Kubernetes cluster so that there is a connection between them.
The installation steps are quite easy, and the steps are well documented here: https://docs.helm.sh/using_helm/#installing-helm, I will personally be following the guide to install Helm on my equipment, and will show some of the execution in Yes. I have a Mac with Sierra, so I need to use the following command:
$ brew install kubernetes-helm
Above are the process prints from installation to finalization. Everything looks okay, so just run the helm init command and start the process. To create a chart, we need to execute the following commands:
$ helm init
$ helm create apiname-cart
Following this, a folder will be generated with the files Chart.yaml, values.yaml and NOTES.txt. The Chart.yaml file will have information such as application name and version, as shown below:
description: A Helm chart for Kubernetes
Values.yaml has the data on application variables, folders, and files as shown below (this is my file generated when I created my chart):
# Default values for apiname-chart.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# Used to create an Ingress record.
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# Secrets must be manually created in the namespace.
# - secretName: chart-example-tls
# - chart-example.local
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# cpu: 100m
# memory: 128Mi
# cpu: 100m
# memory: 128Mi
NOTES.txt provides instructions for deployment. (I did not see the need to provide screenshots of this file.)
When you’re ready to deploy your application with Helm, simply run the command:
$ helm search
You can use it with multiple applications.
And to install an application, just use the command:
$ helm install ./apiname
Helm is very simple to use, efficient, and is much broader than what was shown here. The command interface in the terminal is particularly useful. It lets you focus on the development of the application itself.