The task is to spin up a Redis instance in a Kubernetes cluster.

Will use the Master-Slave replication setup with Sentinels for monitoring and failover operations.

Check the Redis: replication, part 2 — Master-Slave replication, and Redis Sentinel post for more details.

Redis cluster vs Redis replication

See Redis: replication, part 1 — an overview. Replication vs Sharding. Sentinel vs Cluster. Redis topology. and Choose between Redis Helm Chart and Redis Cluster Helm Chart.

In short:

  • Replica — includes a Redis Master instance that performs read-write operations and copies data to its Redis Slaves instance(s) which serves Read-only operations. During this, such a Salve can be promoted to the Master’s role if its Master fails.
  • Cluster — have a sense when your Redis have more data than your server’s RAM. The Cluster can use Sharding and a client requesting a piece of data will be redirected to a node that keeps that data.

Ways to run Redis in Kubernetes

Let’s see how we can perform the task — to run a Redis with replication in a Kubernetes cluster.

In our current case, we don’t need to worry about data’s persistence as our Redis will be used as a cache service only so we don’t need for a Kubernetes PersistentVolume.

#redis #database #kubernetes

Redis: running Master-Slave replication in Kubernetes
11.15 GEEK