我正在尝试使用下面的命令创建一个由3个主、3个从和3个哨兵组成的集群。

helm install --set replicas.master=3 --set replicas.slave=3 stable/redis-ha

但我看到只有一位大师被创造出来。
头盔——0.2.3版
Git回购:https://github.com/kubernetes/charts/tree/master/stable/redis-ha
下面是赫尔姆的日志。
=>     NAME                         DESIRED  CURRENT  AGE
=>    eloping-fox-redis-ha-master  3        1        9s

我是遗漏了什么还是有问题?
我尝试过多个项目,每次只创建一个主控形状。
我正在使用vm/minikube/docker在windows机器上尝试这个。
PS C:\Users\rootus> helm install --set replicas.master=3 --set replicas.slave=3  stable/redis-ha
NAME:   eloping-fox
LAST DEPLOYED: Wed Nov  1 16:34:58 2017
NAMESPACE: default
STATUS: DEPLOYED

RESOURCES:
==> v1beta1/Deployment
NAME                           DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE
eloping-fox-redis-ha           3        3        3           0          9s
eloping-fox-redis-ha-sentinel  3        3        3           0          9s

==> v1beta1/StatefulSet
NAME                         DESIRED  CURRENT  AGE
eloping-fox-redis-ha-master  3        1        9s

==> v1/Pod(related)
NAME                                            READY  STATUS             RESTARTS  AGE
eloping-fox-redis-ha-167683871-2rhn8            0/1    ContainerCreating  0         9s
eloping-fox-redis-ha-167683871-cmjjk            0/1    ContainerCreating  0         9s
eloping-fox-redis-ha-167683871-jf4sn            0/1    ContainerCreating  0         9s
eloping-fox-redis-ha-sentinel-2596454939-9qq06  0/1    ContainerCreating  0         9s
eloping-fox-redis-ha-sentinel-2596454939-ngwcf  0/1    ContainerCreating  0         9s
eloping-fox-redis-ha-sentinel-2596454939-pwkbx  0/1    ContainerCreating  0         9s

==> v1/Service
NAME                  TYPE       CLUSTER-IP  EXTERNAL-IP  PORT(S)    AGE
redis-sentinel        ClusterIP  10.0.0.122  <none>       26379/TCP  9s
eloping-fox-redis-ha  ClusterIP  10.0.0.149  <none>       6379/TCP   9s


NOTES:
Redis cluster can be accessed via port 6379 on the following DNS name from within your cluster:
eloping-fox-redis-ha.default.svc.cluster.local

To connect to your Redis server:

1. Run a Redis pod that you can use as a client:

   kubectl exec -it eloping-fox-redis-ha-master-0 bash

2. Connect using the Redis CLI:

  redis-cli -h eloping-fox-redis-ha.default.svc.cluster.local

=================================================

最佳答案

使用stable/redis-ha舵图,一切正常。
这似乎是您的minikube环境的问题。
默认情况下,minikube2 CPU2048M RAM启动vm。
helm chart中的默认cpu和内存资源如下:

resources:
  master:
    requests:
      memory: 200Mi
      cpu: 100m
    limits:
      memory: 700Mi
  slave:
    requests:
      memory: 200Mi
      cpu: 100m
    limits:
      memory: 200Mi
  sentinel:
    requests:
      memory: 200Mi
      cpu: 100m
    limits:
      memory: 200Mi

当您使用stable/redis-hastable/redis-ha部署3 masters头盔图表时,它只创建3 slaves,因为您的minikube虚拟机上缺少资源:
$ kubectl get pod
NAME                                                   READY     STATUS    RESTARTS   AGE
melting-armadillo-redis-ha-2438719374-8ghdn            1/1       Running   0          2m
melting-armadillo-redis-ha-2438719374-rlq24            1/1       Running   0          2m
melting-armadillo-redis-ha-2438719374-zlg4p            1/1       Running   0          2m
melting-armadillo-redis-ha-master-0                    2/2       Running   0          2m
melting-armadillo-redis-ha-master-1                    0/2       Pending   0          4s
melting-armadillo-redis-ha-sentinel-1377673986-004m8   1/1       Running   0          2m
melting-armadillo-redis-ha-sentinel-1377673986-gcpj2   1/1       Running   0          2m
melting-armadillo-redis-ha-sentinel-1377673986-jh73w   1/1       Running   0          2m

第二个redis主机的pod由于以下原因而处于1 master状态:
  FirstSeen LastSeen    Count   From            SubObjectPath   Type        Reason          Message
  --------- --------    -----   ----            -------------   --------    ------          -------
  16s       1s      6   default-scheduler           Warning     FailedScheduling    No nodes are available that match all of the following predicates:: Insufficient memory (1).

所以你有两种方法来解决你的问题:
使用至少Pending创建minikube环境。
使用4096M RAMstable/redis-ha部署3 masters赫尔姆图,减少内存资源。
第一种方法是:
3 slaves开始:
$ minikube start --memory 4096
Starting local Kubernetes v1.7.5 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.

使用minikube4096M RAM展开stable/redis-ha舵图:
$ helm install --set replicas.master=3 --set replicas.slave=3 stable/redis-ha

最后我们得到:
$ kubectl get pod
NAME                                                 READY     STATUS    RESTARTS   AGE
maudlin-ladybug-redis-ha-1801622981-brmqp            1/1       Running   0          3m
maudlin-ladybug-redis-ha-1801622981-klhr1            1/1       Running   0          3m
maudlin-ladybug-redis-ha-1801622981-mpf3j            1/1       Running   0          3m
maudlin-ladybug-redis-ha-master-0                    2/2       Running   0          3m
maudlin-ladybug-redis-ha-master-1                    2/2       Running   0          1m
maudlin-ladybug-redis-ha-master-2                    2/2       Running   0          1m
maudlin-ladybug-redis-ha-sentinel-3633913943-f8x2c   1/1       Running   0          3m
maudlin-ladybug-redis-ha-sentinel-3633913943-ltvk4   1/1       Running   0          3m
maudlin-ladybug-redis-ha-sentinel-3633913943-xwclg   1/1       Running   0          3m

第二种方法是:
使用3 masters3 slaves部署stable/redis-ha头盔图表,并减少内存资源:
helm install --set replicas.master=3 --set replicas.slave=3 --set resources.master.requests.memory=100Mi --set resources.slave.requests.memory=100Mi --set resources.sentinel.requests.memory=100Mi stable/redis-ha

最后我们得到:
$ kubectl get pod
NAME                                                       READY     STATUS    RESTARTS   AGE
exacerbated-jellyfish-redis-ha-3444643229-085f4            1/1       Running   0          43s
exacerbated-jellyfish-redis-ha-3444643229-bl221            1/1       Running   0          43s
exacerbated-jellyfish-redis-ha-3444643229-qx62b            1/1       Running   0          43s
exacerbated-jellyfish-redis-ha-master-0                    2/2       Running   0          43s
exacerbated-jellyfish-redis-ha-master-1                    2/2       Running   0          36s
exacerbated-jellyfish-redis-ha-master-2                    2/2       Running   0          29s
exacerbated-jellyfish-redis-ha-sentinel-1441222589-czsvx   1/1       Running   0          43s
exacerbated-jellyfish-redis-ha-sentinel-1441222589-ql6n6   1/1       Running   0          43s
exacerbated-jellyfish-redis-ha-sentinel-1441222589-qql1f   1/1       Running   0          43s

关于docker - redis-ha:无法在群集中创建指定数量的主服务器,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47069977/

10-11 15:28