An Introduction to Helm Charts
What is Helm?
When deploying an application on Kubernetes, it is required to define and manage several Kubernetes resources such as pods, services, deployments, and replicasets. Each of these require to write a group of manifest files in YAML format. In the context of a complex application deployment it becomes a difficult task to maintain several manifest files for each of these resources. Furthermore, templating the manifest files and providing configuration parameters externally, can become crucial which will allow to customize the deployments. Dependency management and version control are some other important factors to consider as well. This is where Helm plays a vital role in automating the process of installing, configuring and upgrading complex Kubernetes applications.
Helm is a package manager for Kubernetes. It allows developers and operators to easily package, configure, and deploy applications and services on Kubernetes clusters. Helm packages contain Kubernetes object definitions. With Helm, configuration settings are isolated from manifest files. This allows to template and customize settings without changing the entire manifest file.
Helm Architecture
Helm uses a packaging format called charts. A chart is a collection of files that describes a related set of Kubernetes resources.
In Helm, there are mainly three notions.
- chart : A bundle of information necessary to create an instance of a Kubernetes application.
- config : contains configuration information that can be merged into a packaged chart to create a releasable object.
- release : A running instance of a chart, combined with a specific config.
Helm is implemented in Go programming language and the same binary executable can function as a client (Helm) or a server (Tiller).
Helm Client
Helm client is a command line tool for managing charts. It’s main functionalities are as follows.
- Developing local charts
- Managing repositories
- Interacting with the Tiller server
- Sending charts to be installed in Kubernetes cluster
- Asking for information about releases
- Requesting upgrading or uninstalling of existing releases in cluster
- Serve local charts via HTTP
Tiller Server
Tiller is the server component of Helm that runs on the Kubernetes cluster. It is responsible for managing releases of helm charts. It interacts with both helm client and interface of Kubernetes API server. It handles the configuration and deployment of Helm releases on the cluster.
Tiller processes a chart to generate Kubernetes resource manifests. Tiller then installs the release into the cluster. Tiller stores each release as a Kubernetes ConfigMap.
Main functionalities are as follows.
- Listening for incoming requests from the Helm client
- Combining a chart and configuration to build a release
- Installing charts into Kubernetes, and then tracking the subsequent release
- Upgrading and uninstalling charts by interacting with Kubernetes
Charts
Helm packages are called charts, and they consist of mainly YAML configuration files. Following is the basic directory structure of a chart.
package-name/
charts/
templates/
Chart.yaml
LICENSE
README.md
requirements.yaml
values.yaml
You can find an example of above structure in WSO2 Identity Server Helm resources at [1]
These directories and files have the following functions.
- charts/: Manually managed chart dependencies can be placed in this directory. However recommendation is to use the requirement.yaml file to link dependencies dynamically.
- templates/: This directory contains template files that are combined with configuration values. Configuration values can be read from either values.yaml file or command line. These are then rendered into Kubernetes manifests.
- Chart.yaml: A YAML file with metadata about the chart. E.g. chart name, version, maintainer etc.
- LICENSE: A plaintext license for the chart.
- README.md: A readme file which includes the user guide.
- requirements.yaml: A YAML file that lists the chart’s dependencies.
- values.yaml: A YAML file of default configuration values for the chart.
Repositories
A Helm chart repository is an HTTP site that serves an index.yaml file and packaged charts. These files can be served by any web server, object storage service, or a static site host such as GitHub Pages.
Helm comes pre-configured with a default chart repository, identified by the name stable. This repository points to a Google Storage bucket at https://kubernetes-charts.storage.googleapis.com
. In addition, you can add any external third party repositories. As such any organization can run an operate its own Helm repository.
Releases
When a Helm chart is deployed in a Kubernetes cluster, it is known as a Helm release. This is an instance of a chart that is running in the cluster. Helm automatically maintains a version history of the releases. We can easily get back to any previous state with helm rollback command. Same chart can be deployed multiple times. This result in multiple releases as well.