Redis is an open-source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.  This article will walk through simple steps to install a Redis Instance in Google Kubernetes Engine Cluster. By following this you can set up and deploy a Redis instance for the development environment in just 5 minutes in your existing K8s cluster.

This article assumes that you have a basic knowledge of handling K8s.


Procedure for installing Redis using Helm

Step 1: Creating a secret credential for Redis

Create a secret named “dev-redis-password” from a file containing a Redis password which you need to set for your instance. Note password should be stored in variable named redis-password

kubectl create secret generic dev-redis-password --from-file redis-password=./redis-password.txt

Creating a secret for storing Redis password

Step 2: Installing Redis using the Helm package manager

Run a command in your cluster terminal. Note that the secret file name should be the same in the command as created in the previous step. If you want to expose Redis to the outside you can choose type as LoadBalancer. In command, I have disabled the master-slave configuration. If you are setting up for production then can enable mater slave

helm repo add bitnami

helm install dev-redis --set usePassword=true,usePasswordFile=true,existingSecret=dev-redis-password,cluster.enabled=false,master.persistence.enabled=false,master.service.type=LoadBalancer bitnami/redis

Installing Redis using Helm

Step 3: Finding the Redis Load balancer IP

Your K8s cluster has now Redis installed. After a few minutes, you can navigate to Services and Ingress and hit refresh. The service tab will list your Redis instance. Find the IP address of the load balancer as shown in the below screenshot.

Redis Loadbalancer IP

Step 4: Connecting to Redis instance

You can connect to Redis using CLI by using the following command

redis-cli -h your-load-balancer-ip -p 6379 -a your-secret-password ping

Another option is using a VS Code extension you can connect if you are in need of a GUI tool. I have explained it in my last post

Further References

Hope this guide helped you get started. There are several configurations possible while installing. You can refer to the official guide for more details and configure Redis based on your needs.

Last modified: November 26, 2020



Write a Reply or Comment

Your email address will not be published.