Installing Helm on OVHcloud Managed Kubernetes

Find out how to install Helm on OVHcloud Managed Kubernetes

Last updated 11th January 2023

Helm is a package manager for Kubernetes. It works with packages of pre-configured Kubernetes resources, called Helm charts.

With Helm you can:

Before you begin

This tutorial assumes that you already have a working OVHcloud Managed Kubernetes cluster, and some basic knowledge of how to operate it. If you want to know more on those topics, please look at the OVHcloud Managed Kubernetes Service Quickstart.

We are assuming that you have the KUBECONFIG environment variable pointing to your kubectl configuration file, as described in the Quickstarter. If that's not the case, you can use the --kubeconfig [LOCATION_OF_CONFIG_FILE] option in both kubectl and helm commands.

Helm concepts

Helm is built around three big concepts: charts, repositories and releases.

A chart is a Helm package. Inside the chart you have all the resource definitions necessary to run an application, tool, or service inside of a Kubernetes cluster. It's the Helm equivalent of a Debian pkg for linux, a Maven file for Java or a package.json for Node JS.

Charts are stored in repositories, where they can be shared. Repositories are the Helm equivalent of the NPM registry for Node JS or Maven Central for Java.

When a chart is installed in a Kubernetes cluster, the running instance is called a release. Multiple releases of a single chart can be installed at the same time in a cluster (think for example several instance of the WordPress chart for several different blogs instances running in the cluster).

Installing Helm

This guide supposes you're using Helm 3, the latest major version of Helm. The precedent version, Helm 2, is in maintenance mode, and considered deprecated. If you want to use Helm 2, please refer to the official documentation

Every release of Helm provides binary releases for a variety of OSes. These binary versions can be manually downloaded and installed.

The simplest way to install Helm is grabbing the binary release for your platform on the official release page. You then just need to unpack the client helm binary and add it to your PATH.

To use alternative installation procedures, like package managers (Homebrew, Snap etc.), please refer to the official installation doc.

To check if the helm CLI is correctly installed locally, you can display its version:

helm version

You can show the installed version:

$ helm version
version.BuildInfo{Version:"v3.10.3", GitCommit:"835b7334cfe2e5e27870ab3ed4135f136eecc704", GitTreeState:"clean", GoVersion:"go1.19.4"}

Initialize a Helm Chart Repository

As with Helm 2, the official Helm stable repository is currently deprecated. The Helm community is currently transitioning to a hub model, with a Helm Hub, where charts can be searched using helm search hub <keyword> As most charts from the Helm stable repository have been transferred to the Bitnami repository we are using it in the tutorial.

Once you have Helm ready, you can add a chart repository. The easiest way to begin with Helm is to add the Bitnami repository:

helm repo add bitnami https://charts.bitnami.com/bitnami

Once the repository added, run helm repo update to make sure we get the latest list of charts.

$ helm repo add bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories

$ helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "bitnami" chart repository
Update Complete. ⎈ Happy Helming!⎈

Installing an example chart

Let's validate your Helm installation by installing an example chart, the official Redis one, with no persistence:

helm install test-redis bitnami/redis --set master.persistence.enabled=false

This will install the required elements and initialize the services. And at the end, it will give you the connection parameters for your new Redis database:

$ helm install test-redis bitnami/redis --set master.persistence.enabled=false

helm list -A
NAME: test-redis
LAST DEPLOYED: Wed Jan 11 12:02:08 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: redis
CHART VERSION: 17.4.2
APP VERSION: 7.0.7

** Please be patient while the chart is being deployed **

Redis® can be accessed on the following DNS names from within your cluster:

    test-redis-master.default.svc.cluster.local for read/write operations (port 6379)
    test-redis-replicas.default.svc.cluster.local for read-only operations (port 6379)



To get your password run:

    export REDIS_PASSWORD=$(kubectl get secret --namespace default test-redis -o jsonpath="{.data.redis-password}" | base64 -d)

To connect to your Redis® server:

1. Run a Redis® pod that you can use as a client:

   kubectl run --namespace default redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image docker.io/bitnami/redis:7.0.7-debian-11-r7 --command -- sleep infinity

   Use the following command to attach to the pod:

   kubectl exec --tty -i redis-client \
   --namespace default -- bash

2. Connect using the Redis® CLI:
   REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h test-redis-master
   REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h test-redis-replicas

To connect to your database from outside the cluster execute the following commands:

    kubectl port-forward --namespace default svc/test-redis-master 6379:6379 &
    REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379

Verifying your Redis

After installing the chart, follow the instructions on your console to test your Redis deployment and delete it when your tests are finished.

$ export REDIS_PASSWORD=$(kubectl get secret --namespace default test-redis -o jsonpath="{.data.redis-password}" | base64 -d)

$ kubectl run --namespace default redis-client --restart='Never'  --env REDIS_PASSWORD=$REDIS_PASSWORD  --image docker.io/bitnami/redis:7.0.7-debian-11-r7 --command -- sleep infinity
pod/redis-client created

$ echo $REDIS_PASSWORD
y9WgZhdMHm

$ kubectl exec --tty -i redis-client --namespace default -- bash

I have no name!@redis-client:/$ REDISCLI_AUTH="e3BUbYfAKv" redis-cli -h test-redis-master
test-redis-master:6379> ping
PONG
test-redis-master:6379> exit
I have no name!@redis-client:/$

I have no name!@redis-client:/$ exit
exit

$ kubectl delete pod redis-client
pod "redis-client" deleted

Cleaning up

To clean up your cluster, simply delete your Redis installation. You can use helm list to get the Redis release, in the current namespace, and then use helm delete [REDIS_RELEASE] to uninstall it.

$ helm list
NAME        NAMESPACE   REVISION    UPDATED                             STATUS      CHART           APP VERSION
test-redis  default     1           2023-01-11 12:02:08.08556 +0100 CET deployed    redis-17.4.2    7.0.7

$ helm uninstall test-redis
release "test-redis" uninstalled

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.


These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community