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.
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.
Setting up HELM
Let us now set up helm. Robin has helper utilities to initialize helm.
Project setup for tutorial
Lets create a new project for this tutorial. Add the policy as follows.
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.
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.
Get the password of the redis store from Kubernetes secret.
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.
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.
Lets run the following command to verify that the records are added.
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:
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).
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.