0
votes

By this famous guestbook example:

https://github.com/kubernetes/examples/tree/master/guestbook

It will create Redis master/slave deployment and services. It also has a subfolder named redis-slave which used for create a docker image and run Redis replication command.

  • Dockerfile
  • run.sh

The question is, if deployed the Redis master and slave to the k8s cluster. Then how to run that command? Deploy a new container? That will not relate to the slave container already deployed.

Is there a better way to do Redis repliaciton between master and slave running in k8s cluster?

3
which command you mean? The run.sh command is the entrypoint of the redis-slave container, so when you create the redis-slave deployment on kubernetes, that command will run.Jose Armesto
@fiunchinho I have found that use the redis-slave-deployment.yaml has already included that shell command. So just deploy that manifest will be good enough.online

3 Answers

1
votes

One option you have is using helm to deploy the redis-ha app.

Info about helm: https://github.com/kubernetes/helm

The redis-ha helm app page: https://hub.kubeapps.com/charts/stable/redis-ha

0
votes

Redis Sentinel is often suggested for simple master-slave replication and high availability.

Unfortunately, Sentinel does not fit Kubernetes world well and it also requires a Sentinel-aware client to talk to Redis.

You could try Redis operator which can be considered a Kubernetes-native replacement for Sentinel and allows to create a Redis deployment that would resist without human intervention to most kind of failures.

0
votes

Here is how you can setup Redis HA Master Slave Cluster in Kubernetes/Openshift OKD

Basically you have to use configMap, StatefulSet in collaboration with VolumeClaims

https://reachmnadeem.wordpress.com/2020/10/01/redis-ha-master-slave-cluster-up-and-running-in-openshift-okd-kubernetes/