Skip to content

How to Deploy Redis on OpenShift Easily using HELM

Blog | 08.16.2019 | 4 min read

Jagadish Mukku, Technical Director

Jagadish Mukku is a technical director leading the Data Protection and Cloud Mobility at He played a key role in architecting the ROBIN platform enterprise storage stack that powers data protection, cloud mobility, life cycle management of databases and data intensive applications. Prior to, he was a Senior Architect at Violin Systems known for delivering the industry's first million iops in a 4U All Flash Array. He has been in the storage industry for 19 years starting his career in Veritas and built products in scale out storage, distributed systems, and file systems throughout his career.

  • Share on Twitter
  • Share on Linked In
  • Share on Facebook
  • Email this blog post

Red Hat OpenShift is a popular enterprise Kubernetes application platform. Openshift has been traditionally considered a platform for stateless applications. However, many developers are exploring the possibility of running stateful workloads, such as Redis, on OpenShift. If you are considering extending OpenShift for stateful workloads, this tutorial will help you experiment in your existing OpenShift environment with step-by-step instructions on how to deploy Redis on OpenShift.

Deploy Redis on OpenShift Using Helm

In this tutorial, we will deploy Redis on OpenShift using Helm with a single command, load data in the database, and register the Helm release as an application with Robin Storage.

Before you begin this tutorial, install Robin Storage on your existing OpenShift cluster.

After you have installed Robin, let us run a few commands to make sure the status of  all nodes are in the expected state. The nodes should be in “ready” state.

Let us now confirm that OpenShift cluster is up and running.

oc get nodes

You should see an output similar to below, with the list of nodes and their status as “Ready”.

Let us confirm that Robin is up and running. Run the following command to verify that Robin Storage is ready.

oc get robincluster -n robinio

Setting up HELM

Let us now set up helm. Robin has helper utilities to initialize helm.

robin k8s deploy-tiller-objects
robin k8s helm-setup
helm repo add stable

Project setup for tutorial

Lets create a new project for this tutorial. Add the policy as follows.

oc new-project redis-tutorial oc adm policy add-scc-to-user anyuid system:serviceaccount:redis-tutorial:default

Let us now create a Redis cluster using Helm and Robin Storage. Run the following command to install Redis. We are setting the storageClass to robin-0-3 to benefit from the data management capabilities that Robin Storage brings.

helm install stable/redis --name employees --set master.persistence.storageClass=robin-0-3 --set slave.persistence.storageClass=robin-0-3 --set master.service.type=LoadBalancer --namespace redis-tutorial

Let’s confirm that redis is deployed and all relevant Kubernetes resources are ready.
You should be able to see an output showing the status of your redis store.

Get the service IP address of our Redis store.

export REDIS_PASSWORD=$(oc get secret --namespace redis-tutorial employees-redis -o jsonpath="{.data.redis-password}" | base64 --decode)

Get the password of the redis store from Kubernetes secret.

export SERVICE_IP=$(oc get svc --namespace redis-tutorial employees-redis-master --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}")

Create a Redis client pod

Run a Redis pod that can be used as a Redis client. This will be used to connect to redis store and add data.

oc run --namespace default employees-redis-client --rm --tty -i --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --env SERVICE_IP=$SERVICE_IP --image -- bash

From this point in the document, “redis-cli” invocations are always in the “employees-redis-client” pod.

Adding data to the Redis store

We will insert employee entries into redis store. Lets use the redis-cli from the redis client pod.

hmset employees e000001 'Carmina Chilcote' e000002 'Werner Whobrey' e000003 'Jenna Jarmon' e000004 'Norbert Niswonger' e000004 'Randell Reimers' e000005 'Janay Jacobi' e000006 'Tammara Theobald' e000007 'Margret Michelin' e000008 'Daron Desrosier' e000009 'Raymon Riggenbach'

Lets run the following command to verify that the records are added.

redis-cli -h $SERVICE_IP -a $REDIS_PASSWORD hvals employees

We now have a Redis database deployed on OpenShift with some sample data. Now, let’s take a look at the data management capabilities Robin brings, such as taking snapshots, making clones, and creating backups.

Registering the Redis Helm release as an application

To benefit from the data management capabilities, we’ll register our Redis database with Robin. Doing so will let Robin map and track all resources associated with the Helm release for this Redis database.

Let us first get the ‘robin’ client utility and set it up to work with this OpenShift cluster.

To get the link to download robin client run the following command:

robin app register empapp --app helm/employees -n redis-tutorial

Let us now verify Robin is now tracking our Redis Helm release as a single entity (app).
You should see an output similar to the following.

Let us now verify that Robin is tracking our Redis Helm release as a single entity (app).

robin app status --app empapp

We have successfully registered our Helm release as an app called “empapp”.

This concludes the Deploy Redis on OpenShift tutorial. Now that we have deployed the Redis database, loaded data, and registered the Redis Helm release with Robin, we can create a Redis database snapshot and create a Redis clone including app plus data.

Related Posts​