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.
wordpress/
Chart.yaml # A YAML file containing information about the chart
LICENSE # OPTIONAL: A plain text file containing the license for the chart
README.md # OPTIONAL: A human-readable README file
values.yaml # The default configuration values for this chart
values.schema.json # OPTIONAL: A JSON Schema for imposing a structure on the values.yaml file
charts/ # A directory containing any charts upon which this chart depends.
crds/ # Custom Resource Definitions
templates/ # A directory of templates that, when combined with values,
# will generate valid Kubernetes manifest files.
templates/NOTES.txt # OPTIONAL: A plain text file containing short usage notesChart
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
A Repository is the place where charts can be collected and shared. It's like Perl's CPAN archive or the Fedora Package Database, but for Kubernetes packages.
In Helm, one chart may depend on any number of other charts. These dependencies can be dynamically linked using the
dependenciesfield inChart.yamlor 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
Helm Chart templates are written in the Go template language
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.yamlinside 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 totrueif the current operation is an upgrade or rollback.Release.IsInstall: This is set totrueif 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.yamlfile and from user-supplied files. By default,Valuesis empty.Chart: The contents of theChart.yamlfile. Any data inChart.yamlwill be accessible here. For example{{ .Chart.Name }}-{{ .Chart.Version }}will print out themychart-0.1.0.The available fields are listed in the Charts Guide
Files: This provides access to all non-special files in a chart. While you cannot use it to access templates, you can use it to access other files in the chart. See the section Accessing Files for more.Files.Getis a function for getting a file by name (.Files.Get config.ini)Files.GetBytesis 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.Globis a function that returns a list of files whose names match the given shell glob pattern.Files.Linesis a function that reads a file line-by-line. This is useful for iterating over each line in a file.Files.AsSecretsis a function that returns the file bodies as Base 64 encoded strings.Files.AsConfigis 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?