Redis sentinel cluster in kubernetes, sentinel is not able to reach redis master

11/20/2019

I am working on creating a Redis sentinel cluster by using below:

https://github.com/kubernetes/examples/tree/master/staging/storage/redis

It's working awesome with the given image, but when we use the Redis official image the sentinel is not able to connect to Redis in the first pod.

It's showing below error:

Could not connect to redis at -p:6379

How can I create a cluster with the official image of Redis?

-- Ashish Palecha
docker
kubernetes
redis
redis-sentinel

1 Answer

11/22/2019

To replace image from google repository to public docker hub image the following deployment files need to be modified for this example:

examples/staging/storage/redis/redis-master.yaml
examples/staging/storage/redis/redis-sentinel-service.yaml
examples/staging/storage/redis/redis-controller.yaml

In those files You will find image configurations like this:

spec:
      containers:
      - name: sentinel
        image: k8s.gcr.io/redis:v1

replace all of the image: k8s.gcr.io/redis:v1 to image: redis:stable or to image: redis:latest.

After modyfying those image configurations should look like this:

spec:
      containers:
      - name: sentinel
        image: redis:stable

The alpine image in dockerfile You mentioned is used to run scripts in order to Remove trailing whitespaces.


Update:

Upon further investigation it seems that this example is using specific redis image from GCR repository and replacing it with official redis image will not work.

If You want to deploy redis in kubernetes i suggest using bitnami-docker-redis github project. More information about installing it on kubernetes can be found here.

The official redis github page and redis documentation don't mention anything about deploying redis on kubernetes.

-- Piotr Malec
Source: StackOverflow