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
Using 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:
apiVersion: v1 description: A Helm chart for Kubernetes name: apiname-chart version: 0.1.0
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. replicaCount: 1 image: repository: nginx tag: stable pullPolicy: IfNotPresent service: name: nginx type: ClusterIP externalPort: 80 internalPort: 80 ingress: enabled: false # Used to create an Ingress record. hosts: - chart-example.local annotations: # kubernetes.io/ingress.class: nginx # kubernetes.io/tls-acme: "true" tls: # Secrets must be manually created in the namespace. # - secretName: chart-example-tls # hosts: # - chart-example.local resources: {} # 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:'. # limits: # cpu: 100m # memory: 128Mi # requests: # 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
Conclusion
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.