Installing Helm on OVHcloud Managed Kubernetes

Find out how to install Helm on OVHcloud Managed Kubernetes

Last updated December 20 2021.

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 calls.

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.7.0", GitCommit:"eeac83883cb4014fe60267ec6373570374ce770b", GitTreeState:"clean", GoVersion:"go1.17"}

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

NAME: test-redis
LAST DEPLOYED: Mon Dec 20 11:10:15 2021
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: redis
CHART VERSION: 15.6.7
APP VERSION: 6.2.6

** 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 --decode)

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 REDISCLI_AUTH=$REDIS_PASSWORD  --image docker.io/bitnami/redis:6.2.6-debian-10-r53 --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.

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

$ kubectl run --namespace default redis-client --restart='Never'  --env REDISCLI_AUTH=$REDIS_PASSWORD  --image docker.io/bitnami/redis:6.2.6-debian-10-r53 --command -- sleep infinity
pod/redis-client created

$ echo $REDIS_PASSWORD
e3BUbYfAKv

$ 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, and then helm delete [REDIS_RELEASE].

$ helm list
NAME        NAMESPACE   REVISION    UPDATED                                 STATUS      CHART           APP VERSION
test-redis  default     1           2021-12-20 11:10:15.401273 +0100 CET    deployed    redis-15.6.7    6.2.6

$ helm delete 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