简体   繁体   English

kubernetes中的Redis哨兵集群,哨兵无法到达redis主控

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

I am working on creating a Redis sentinel cluster by using below:我正在使用以下方法创建 Redis 哨兵集群:

https://github.com/kubernetes/examples/tree/master/staging/storage/redis 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.它与给定的图像一起工作很棒,但是当我们使用 Redis 官方图像时,哨兵无法连接到第一个 pod 中的 Redis。

It's showing below error:它显示以下错误:

Could not connect to redis at -p:6379无法在 -p:6379 连接到 redis

How can I create a cluster with the official image of Redis?如何使用Redis的官方镜像创建集群?

To replace image from google repository to public docker hub image the following deployment files need to be modified for this example:要将图像从 google 存储库替换为公共 docker 集线器图像,需要为此示例修改以下部署文件:

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 .将所有image: k8s.gcr.io/redis:v1image: redis:stableimage: 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.您提到的 dockerfile 中的高山图像用于运行脚本以删除尾随空格。


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.经过进一步调查,该示例似乎使用了来自 GCR 存储库的特定 redis 图像,并将其替换为官方 redis 图像将不起作用。

If You want to deploy redis in kubernetes i suggest using bitnami-docker-redis github project.如果您想在 kubernetes 中部署 redis,我建议使用bitnami-docker-redis github 项目。 More information about installing it on kubernetes can be found here .有关在 kubernetes 上安装它的更多信息,请参见 此处

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM