Helm
Introduction
Helm is a package manager for Kubernetes that simplifies the deployment and management of applications on a Kubernetes cluster.
It is organized as a collection of files inside of a directory. The directory name is the name of the chart (without versioning information). Thus, a chart describing WordPress would be stored in a
wordpress/
directory.
Chart
Introduction
A chart is a collection of files that describe a set of Kubernetes resources, such as deployments, services, config maps, and more. It provides a standardized and repeatable way to define, configure, and deploy complex applications on Kubernetes. So that, the resources can be deployed at once. It contains the following fields
Repository & Dependencies
In Helm, one chart may depend on any number of other charts. These dependencies can be dynamically linked using the
dependencies
field inChart.yaml
or brought in to thecharts/
directory and managed manually.
After declaring the source of dependencies, it is needed to fetch the dependency charts
When helm dependency update
retrieves charts, it will store them as chart archives in the charts/
directory. So the charts will be fetched in format of zip file
Templates & Values
Introduction
All template files are stored in a chart's
templates/
folder. When Helm renders the charts, it will pass every file in that directory through the template engine.Values (Variables) for the templates are supplied two ways:
Chart developers may supply a file called
values.yaml
inside of a chart. This file can contain default values.Chart users may supply a YAML file that contains values. This can be provided on the command line with
helm install
Override
Parent Values file can supply values to the chart as well as to any of its dependencies
E.g: Wordpress contains mysql chart and apache chart, the values can be declared in parent value file, it will override or supply the value to the child
The value must be started with child alias as a prefix
Values are namespaced, but namespaces are pruned. So for the WordPress chart, it can access the MySQL password field as
.Values.mysql.password
. But for the MySQL chart, the scope of the values has been reduced and the namespace prefix removed, so it will see the password field simply as.Values.password
.
Global
Helm supports special "global" value. example:
It will be regenerated the result like this
Pre-built Object
Release
: This object describes the release itself. It has several objects inside of it:Release.Name
: The release nameRelease.Namespace
: The namespace to be released into (if the manifest doesn’t override)Release.IsUpgrade
: This is set totrue
if the current operation is an upgrade or rollback.Release.IsInstall
: This is set totrue
if the current operation is an install.Release.Revision
: The revision number for this release. On install, this is 1, and it is incremented with each upgrade and rollback.Release.Service
: The service that is rendering the present template. On Helm, this is alwaysHelm
.
Values
: Values passed into the template from thevalues.yaml
file and from user-supplied files. By default,Values
is empty.Chart
: The contents of theChart.yaml
file. Any data inChart.yaml
will be accessible here. For example{{ .Chart.Name }}-{{ .Chart.Version }}
will print out themychart-0.1.0
.Files.Get
is a function for getting a file by name (.Files.Get config.ini
)Files.GetBytes
is a function for getting the contents of a file as an array of bytes instead of as a string. This is useful for things like images.Files.Glob
is a function that returns a list of files whose names match the given shell glob pattern.Files.Lines
is a function that reads a file line-by-line. This is useful for iterating over each line in a file.Files.AsSecrets
is a function that returns the file bodies as Base 64 encoded strings.Files.AsConfig
is a function that returns file bodies as a YAML map.
Release
Introduction
A Release is an instance of a chart running in a Kubernetes cluster. One chart can often be installed many times into the same cluster. And each time it is installed, a new release is created. Consider a MySQL chart. If you want two databases running in your cluster, you can install that chart twice. Each one will have its own release, which will in turn have its own release name.
Command
Here are the commands of manage release based on the chart
Reference
Last updated
Was this helpful?