Helm - Package manager for Kubernetes

Introduction

  • Helm is like a package manager for K8s.
  • A Chart is a Helm package.
  • A Repository is a place where charts can be collected and shared.
  • A Release is an instance of a chart running in a K8s cluster.
  • Helm installs charts into K8s, creating a new release for each installation.

Usage

  • helm install is used to install a chart.
  • Release names may be manually specified or automatically generated.
  • helm status <release-name> can be used to track the status of a release.
  • A chart can be customized before installation. Run helm show values <package> to see the available configuration options.
  • The configuration options can be overridden with an YAML file. E.g. helm install -f values.yaml <package>. You can also use the —set directive to set configuration values.
  • helm upgrade is used to upgrade to a new version of a chart.
  • helm rollback is used to rollback to a previous version of a chart.
  • Useful options:
    • —timeout sets the wait for K8s commands to complete.
    • —wait waits until all pods are in a ready state.
    • —no-hooks skips running hooks.
  • helm uninstall <release> can be used to uninstall a particular release.
  • helm list shows all release records.
  • helm repo allows you to work with repositories. It has commands such as list, add, and remove.
  • helm create is used to create your own chart.
  • helm package is used to package the chart for distribution.

Templating

  • Helm uses Go templates for templating.
  • It includes the functions provided by the package sprig.
  • include lets you include another template.
  • required allows you to declare particular values as required for template rendering.
  • Prefer quoting strings using {{ .Values.Foo | quote }}.
  • tpl allows you to evaluate strings as templates inside a template.
  • A checksum/config annotation can be used to guarantee a Deployment is restarted when one of its ConfigMaps (i.e. an external dependency) changes.
  • Any template that begins with an is not expected to output a Kubernetes manifest file. By convention, helper templates and partials are placed in a _helpers.tpl file.
  • Built-in objects are available, such as:
    • Release, related with the release and its state.
    • Values, which are the values passed from values.yaml.
    • Chart, which are the contents of Chart.yaml.
    • Files, to access any other type of file in the charts.
    • Capabilities, which provides information about the K8s cluster capabilities.
    • Template, which provides information about the current template being executed.