Helm Renders a Chart's Templates with Your Values Before Applying Them
Helm packages a Kubernetes application as a chart: templated manifests plus a values.yaml of defaults. helm install merges the values you give over those defaults, renders the templates into plain manifests, applies them, and records the result as a named release. You configure a third-party application through its values instead of writing its ServiceAccounts, roles and Deployments yourself.
Chart, Values, Release
| Term | What it is |
|---|---|
| Chart | a versioned package of templates, default values and metadata |
| Repository | where charts are published (helm repo add <name> <url>) |
| Values | the settings that fill the templates: chart defaults, overridden by -f my-values.yaml, overridden by --set |
| Release | one installation of a chart in a namespace, with a numbered history of revisions |
The Workflow
helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
helm show values nfs-subdir-external-provisioner/nfs-subdir-external-provisioner # the knobs
helm template my-release <chart> -f my-values.yaml # print the manifests, apply nothing
helm upgrade --install my-release <chart> -n <ns> -f my-values.yaml
helm get values my-release -n <ns> # what this release was given
helm rollback my-release 1 -n <ns> # back to revision 1
helm template shows exactly what will reach the cluster, which is the quickest way to check what a value really changes. upgrade --install works whether or not the release exists, so it is the form to put in scripts.
When Helm Helps
Helm saves the most on community software with many moving parts: an NFS provisioner, an ingress controller, a database. In my homelab, the provisioner chart needed only the NFS server and path, and it created the objects behind the claims I use (see A PersistentVolumeClaim Requests Storage and a StorageClass Provisions It). For a few manifests of my own, plain YAML or Kustomize is simpler than a template language. GitOps agents can deploy charts too, with the values file kept in Git (see GitOps Agents Pull the Desired State from Git and Revert Changes Made Outside It).
References
- Kubernetes MOC - hub for Kubernetes notes.
- A PersistentVolumeClaim Requests Storage and a StorageClass Provisions It - the storage objects the provisioner chart serves.
- GitOps Agents Pull the Desired State from Git and Revert Changes Made Outside It - keeping releases and their values in Git.
- Helm documentation: Using Helm - charts, repositories, releases and values.
- Helm documentation: helm upgrade -
--installand--reuse-values. - nfs-subdir-external-provisioner - the chart used as the example.