Helm is to Kubernetes what package managers like yum/apt/homebrew are to traditional operating systems. It leverages Charts to handle Kubernetes manifest files.
Basic Usage of Helm
To install the helm client, simply input
brewinstallkubernetes-helm
Initialize Helm and install the Tiller service (with kubectl preconfigured)
helminit
For Kubernetes versions v1.16.0 and above, you may encounter an Error: error installing: the server could not find the requested resource. This results from extensions/v1beta1 being replaced by apps/v1. The resolution is
For more usage of commands, refer to the "Helm Command Reference" section below.
How Helm Works
Basic Concepts
Helm centers around three concepts:
Chart: A Helm application (package), consisting of all associated Kubernetes manifest templates. Analogous to YUM RPM or Apt dpkg files.
Repository: The storage depot for Helm packages.
Release: The deployment instance of a chart. Each chart can deploy one or multiple releases.
Working Principle of Helm
Helm comprises two components: helm client and tiller server.
The client is responsible for managing charts, while the server handles release management.
helm client
The helm client is a command-line tool responsible for the management of charts, repositories, and releases. It communicates with tiller via a gPRC API (this is done via 'kubectl port-forward' to map tiller's port to the local machine, then communicate with tiller through the mapped port), sending commands for tiller to manage corresponding Kubernetes resources.
Usage of helm commands can be found in the "Helm Command Reference" section below.
tiller server
Tiller receives requests sent from the helm client and relays the resource operations to Kubernetes, managing (installing, querying, upgrading, or deletion, etc.) and tracking the Kubernetes resources. To facilitate this, tiller saves release-specific information in Kubernetes ConfigMap.
Tiller exposes a gRPC API for the helm client to call.
Helm Charts
Helm employs Charts to manage Kubernetes manifest files. Each chart minimally includes:
Basic information of the application Chart.yaml
One or more Kubernetes manifest file templates (stored under templates/ directory), encompassing various Kubernetes resources such as Pod, Deployment, Service, and so on.
Chart.yaml Example
name:The name of the chart (required)version:A SemVer 2 version (required)description:A single-sentence description of this project (optional)keywords: - A list of keywords about this project (optional)home:The URL of this project's home page (optional)sources: - A list of URLs to source code for this project (optional)maintainers:# (optional) - name:The maintainer's name (required for each maintainer)email:The maintainer's email (optional for each maintainer)engine:gotpl# The name of the template engine (optional, defaults to gotpl)icon:A URL to an SVG or PNG image to be used as an icon (optional).
Dependency Management
There are two main ways in which Helm manages dependencies:
Directly placing dependent packages in charts/ directory
Using requirements.yaml and helm dep up foochart to automatically download dependent packages
The default values for template parameters should be placed in values.yaml file, with the format:
imageRegistry:"quay.io/deis"dockerTag:"latest"pullPolicy:"alwaysPull"storage:"s3"# Default parameters of the dependent MySQL chartmysql:max_connections:100password:"secret"
Helm Plugins
Plugins offer a way to extend the functionality of Helm. They are executed on the client side and located in $(helm home)/plugins directory.
name:"keybase"version:"0.1.0"usage:"Integrate Keybase.io tools with Helm"description:|- This plugin provides Keybase services to Helm.ignoreFlags:falseuseTunnel:falsecommand:"$HELM_PLUGIN_DIR/keybase.sh"
In this manner, the command helm keybase can be used to call this plugin.
Helm Command Reference
Querying Charts
helmsearchhelmsearchmysql
Retrieving Package Details
helminspectstable/mariadb
Deploying Packages
helminstallstable/mysql
Options for packages can also be customized before deployment:
# Querying possible optionshelminspectvaluesstable/mysql# Customizing passwordecho"mysqlRootPassword: passwd">config.yamlhelminstall-fconfig.yamlstable/mysql
Moreover, you can deploy apps through a package file (i.e., .tgz) or local package path (e.g., path/foo).