Helm Introduction
Helm is package manager and a templating engine for Kubernetes. It allows you to define, install, and upgrade even the most complex Kubernetes applications. It's like apt, yum, or homebrew for Kubernetes. Primary use case is application deployment and environment management.
Helm Architecture
The new architecture of Helm 3 is very simple. It has only client-side components. The server-side components like Tiller are removed in Helm 3. Helm 3 is a client-side application that interacts with the Kubernetes API server.
Using a Helm Chart
To deploy an application using Helm, you need to create a Helm chart. A Helm chart is a collection of files that describe a related set of Kubernetes resources. A single chart might be used to deploy something simple, like a memcached pod, or something complex, like a full web app stack with HTTP servers, databases, caches, and so on.
First we need to add the repository to the helm
helm repo add bitnami https://charts.bitnami.com/bitnami
- We can update the repository using the following command
helm repo update
- Then we can install the chart using the following command
helm install postgres bitnami/postgresql
we can search for the available charts using the following command
helm search repo bitnami
Or search the available versions of the chart using the following command
helm search repo bitnami/postgresql --versions
We can also pull the chart locally to look at the configuration files. --version
flag is used to specify the version of the chart not the app version
helm pull bitnami/postgresql --version 16.3.0
We can give values to the chart using the values flag and padding the values in the yaml file
helm install postgresql bitnami/postgresql --values values.yaml
The values.yaml file should look like this
commonAnnotations:
foo: bar
We can upgrade the chart using the following command
helm upgrade --install postgresql bitnami/postgresql --values values.yaml --version=16.4.0 --namespace=my-namespace
We can rollback the chart using the following command postgresql
is the release name we can get the release name using helm list
.
helm rollback postgresql
To check helm release status
helm list
To check values provided by the user. Again postgresql
is the release name
helm get values postgresql
We can also get actual manifest files that are generated by the helm chart. Again postgresql
is the release name
helm get manifest postgresql
We can uninstall the chart using the following command. Again postgresql
is the release name
helm uninstall postgresql
Creating our own Helm Chart
- We can create our own helm chart using the following command. It will generate a dir with all the boilerplate code.
helm create mychart
- We can install the chart using the following command.
mychart
is the chart name and./mychart
is the path to the chart
helm install mychart ./mychart
We can also apply with a values file
helm install mychart ./mychart --values values.yaml
Helm Hooks
Helm hooks are a way to interact with the lifecycle of a release. They allow you to intervene at certain points in a release's life cycle. Helm supports the following hooks:
pre-install
- Runs before any templates are rendered.post-install
- Runs after all templates have been rendered and resources have been created.
What's next?
Learning Resources - Learn more about Helm with these resources.