Helm basics…

For a typical cloud-native application with a 3-tier architecture, each tier consists of a Deployment and Service object, and may additionally define ConfigMap or Secret objects. Each of these objects are typically defined in separate YAML files, and are fed into the kubectl command line tool.

A Helm chart encapsulates each of these YAML definitions, provides a mechanism for configuration at deploy-time and allows you to define metadata and documentation

https://docs.bitnami.com/tutorials/create-your-first-helm-chart/

Helm charts are structured like this:

The templates/ directory is for template files. When Helm evaluates a chart, it will send all of the files in the templates/ directory through the template rendering engine. It then collects the results of those templates and sends them on to Kubernetes.

The values.yaml file is also important to templates. This file contains the default values for a chart. These values may be overridden by users during helm install or helm upgrade.

The Chart.yaml file contains a description of the chart. You can access it from within a template.

charts/ directory may contain other charts (which we call subcharts). Later in this guide we will see how those work when it comes to template rendering.

Use this command to create a new chart named mychart in a new directory:

helm create mychart

https://helm.sh/docs/chart_template_guide/getting_started/

Helm runs each file in [template] directory through a Go template rendering engine.

We can do a dry-run of a helm install and enable debug to inspect the generated definitions:

helm install --dry-run --debug ./mychart

We can use helm package to create the tar package:

helm package ./mychart

Helm will create a mychart-0.1.0.tgz package in our working directory, using the name and version from the metadata defined in the Chart.yaml file. A user can install from this package instead of a local directory by passing the package as the parameter to helm install.

helm install example3 mychart-0.1.0.tgz

Helm allows you to specify sub-charts that will be created as part of the same release. To define a dependency, create a requirements.yaml file in the chart root directory.

https://docs.bitnami.com/tutorials/create-your-first-helm-chart/

Template files should have the extension .yaml if they produce YAML output. The extension .tpl may be used for template files that produce no formatted content.

https://helm.sh/docs/chart_best_practices/templates/

Leave a comment