Deploying Redis® on RKS

02 May 2022

Redis® is an in-memory data structure store which is often used as a distributed key-value store. Redis® has a single master mode and multiple replicas. The master is the endpoint for write operations. Read operations can also be done from the replicas.
In this document we will show you how to easily install Redis® in RKS.

Prerequisites

  • An account on the Ridge cloud
  • Kubectl, the command line tool for Kubernetes
  • Redis-cli the CLI tool for  Redis®.  Install redis-tools:
  • helm the Kubernetes package manager

Creating a Kubernetes Cluster

For a step-by-step guide, visit our guide on how to create a Kubernetes cluster.

Once you are successful, continue here:

Now that our cluster is ready and we have downloaded the kubeconfig file, let’s verify that our cluster is up and running. To verify that you have a running master and worker node,  list the nodes by executing:

If everything works, you should something similar to this:

Now we are ready to deploy Redis®.

Deploying Redis® with Helm

In this tutorial we use a helm chart from Bitnami. First, add the Bitnami helm repo.

Deploy Redis® using the helm chart with the name redis. The LoadBalancer parameters allow the master and replicas to be reachable from the Internet.

The resulting output will look like this:

At this stage you can check and see the services through kubectl. Notice the services of the master and the replicas.

In the Ridge cloud console you will also be able to see the load balancers that forwards traffic to the nodes that are running the pods.

To remove Redis® from the cluster at a later time use:

 

Accessing Redis®

Accessing Redis® requires the password. Retrieve the password with:

Use the following to retrieve the master-service external IP:

Next, launch the CLI:

The output will look like this:

Since this is the master, it is possible to both read and write. Define a key ‘x’ and set its value to 77. Then read the value and see it has been set correctly.

Now let’s check what we can do when we connect to the replica service. First get the external IP of the replica service:

Launch the CLI client:

Note that you can read ‘x’ but you can’t write a value into ‘y’: