My basic understanding and usage of Helm Chart
There are two major components: Repository and Release. A repository has one or many charts. Each chart is installed as a release to K8s. The relationship is:
repo → chart → release
Repository
helm repo list
List all the added repositories to K8s’ Helm chart repository.
# helm repo list [flags]helm repo list
helm repo add
Add a repository to Kubernetes’ Helm chart repository e.g.
# helm repo add [NAME] [URL] [flags]helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart
Another classic repository to add to our K8s’ Helm chart repository is
# helm repo add [NAME] [URL] [flags]helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
Ensure the latest state of the repository.
helm repo update
helm search repo
Find charts in all of my K8s’ Helm chart repositories e.g. find charts containing keyword bitn
# helm search repo [keyword] [flags]helm search repo bitn
Another example is to find charts containing keyword splunk
# helm search repo [keyword] [flags]helm search repo splunk
Release
helm list
List all the installed charts (a.k.a. releases).
# helm list [flags]helm listhelm list -a # list all including pending releaseshelm list -n xyznamespace
helm install (without the desired config values)
Install a chart for Kubernetes without the desired configuration values.
# helm install [NAME] [CHART] [flags]helm install xyz-release-name bitnami/<chart>
Another example is installing a Splunk OTel chart for K8s without the desired configuration values but with generated release name.
# helm install [NAME] [CHART] [flags]helm install --generate-name splunk-otel-collector-chart/splunk-otel-collector
helm install (with the desired config values)
Install a chart for Kubernetes with the desired configuration values.
# helm install [NAME] [CHART] [flags]
helm install xyz-abc-release-name bitnami/apache \--set replicaCount=2 \--set image.debug=true
Another example is to install a Splunk OpenTelemetry Collector chart for k8s with the desired config values.
# helm install [NAME] [CHART] [flags]
helm install --set clusterName='test-helm-repo-config' \--set gateway.enabled='false' \--set splunkObservability.logsEnabled='true' \--generate-name splunk-otel-collector-chart/splunk-otel-collector
helm uninstall
Get the name of a release and uninstall a chart for K8s using the release name.
helm list
# helm uninstall RELEASE_NAME [...] [flags]helm uninstall xyz-release-name
FAQ
Q: I want to view the content of a chart before installing, how do I download a chart from repository without installing it yet?
First, add a repository, update repo, then search for the chart in repo.
helm repo add splunk-otel-collector-chart https://signalfx.github.io/splunk-otel-collector-chart
helm repo update
helm search repo splunk
Second, pull (i.e. download without installing) the chart. The untar version will extract the download because it is usually downloaded in the tar version.
cd Downloads # this is optional. Depending on the folder you prefer
helm pull --untar splunk-otel-collector-chart/splunk-otel-collector
cd splunk-otel-collector
Third, we can install the downloaded version.
# make changes to the values.yaml file as desired
helm install xyz-release-name ./splunk-otel-collector # assuming we are in the folder
Q: How do I know what values can I configure when installing the chart?
First, we need to get the chart name.
Second, we show the values that can be configured.
# helm show values [CHART] [flags]
helm show values bitnami/nginx # The above command will show a long list of all possible value-settings
helm show values bitnami/apache | yq e # parse yaml and show with colorssplunk-otel-collector-chart/splunk-otel-collector
Third, we could install the chart with desired config values.
# helm install [NAME] [CHART] [flags]helm install xyz-abc-release-name bitnami/apache \--set replicaCount=2 \--set image.debug=true
Fourth, we could install the chart with set and values flags.
# helm install [NAME] [CHART] [flags]helm install --generate-name splunk-otel-collector-chart/splunk-otel-collector --set gateway.replicaCount=5 --values values.yaml
- generate-name is to auto generate a name instead of us specifying a name
- set gateway.replicaCount overrides the content in values.yaml
- splunk-otel…/…tor is the chart
Q: How do I upgrade a release?
First, update the repository and search for a chart in the repostiory.
helm repo updatehelm search repo nginx
Second, get the name of the release from the list of releases.
helm list -a
Third, upgrade the release
# helm upgrade [RELEASE] [CHART] [flags]
helm upgrade xyz-release-name bitnami/nginx
Or upgrade the release with values.yaml
# helm upgrade [RELEASE] [CHART] [flags]helm upgrade splunk-otel-collector-1646294869 splunk-otel-collector-chart/splunk-otel-collector --values values.yaml
Q: How to preview the values of a release after installing the helm chart?
See the name of the release.
helm ls
For e.g. helm get values <release name>
helm get values splunk-otel-collector-1663745296
Q: How do I rollback a release?
Similar to upgrade. Instead of helm upgrade
use helm rollback
.