Installing Helm on OVHcloud Managed Kubernetes

Find out how to install Helm on OVHcloud Managed Kubernetes

Last updated April 14th, 2020.

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

[!warn] 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.

Initialize a Helm Chart Repository

[!warn] 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

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

$ helm repo add 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: Tue Apr 14 15:13:14 2020
NAMESPACE: default
STATUS: deployed
** Please be patient while the chart is being deployed **
Redis can be accessed via port 6379 on the following DNS names from within your cluster:

test-redis-master.default.svc.cluster.local for read/write operations
test-redis-slave.default.svc.cluster.local for read-only operations

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 test-redis-client --rm --tty -i --restart='Never' \
   --image -- bash

2. Connect using the Redis CLI:
   redis-cli -h test-redis-master -a $REDIS_PASSWORD
   redis-cli -h test-redis-slave -a $REDIS_PASSWORD

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

    kubectl port-forward --namespace default svc/test-redis-master 6379:6379 &
    redis-cli -h -p 6379 -a $REDIS_PASSWORD

Verifying your Redis

After installing the chart, follow the instructions on your console to test your Redis deployment.

$ export REDIS_PASSWORD=$(kubectl get secret --namespace default test-redis \ >     -o jsonpath="{.data.redis-password}" | base64 --decode)
$ kubectl run --namespace default test-redis-client --rm --tty -i --restart='Never' \
>     --image -- bash
If you don't see a command prompt, try pressing enter.
I have no name!@test-redis-client:/$  redis-cli -h test-redis-master -a $REDIS_PASSWORD
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
test-redis-master:6379> cluster info
ERR This instance has cluster support disabled
test-redis-master:6379> ping
test-redis-master:6379> exit
I have no name!@test-redis-client:/$ exit
pod "test-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          2020-04-14 14:23:46  deployed   redis-10.5.7   5.0.7
$ 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