DPS0340 / redis-operator-practice

redis-operator with valkey image redis cluster
Apache License 2.0
1 stars 0 forks source link

How to run ValKey in cluster mode? #1

Open arpan57 opened 3 months ago

arpan57 commented 3 months ago

Hello @DPS0340,

Thank you for work on this area. I am trying to make valekey cluster run on the k8s and searching for an patched redis operator or a new operator, came across your git repo.

I cloned the repo and executed ./01-install.sh successfully on the minikube on macbook. What I noticed is the image which has been used in theredis-operator-0.18.0/custom-resources/redis-cluster.yaml is for the single instance. Currently, using the operator, I noticed it spawns 6 pods ( 3 leaders+3 followers) but when I try to execute any cluster related commands it fails. (because this operator is using the image for redis-instance)

❯ kubectl exec -it redis-cluster-leader-0 -- valkey-cli
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> cluster nodes
ERR This instance has cluster support disabled
127.0.0.1:6379>

I tried modifying the image and pass the appropriate environment values, and try creating the Valkey cluster. Notice here I am setting the image to bitnami/valkey-cluster For example :

helm install valkey-test ot-helm/redis-cluster \
       --set redisCluster.clusterSize=3 \
       --set redisCluster.image="bitnami/valkey-cluster" \
       --set redisCluster.tag="latest" \
       --namespace valkey-cluster-trial \
       -f values.yaml

and in the values.yaml setting environment variables, which we figured out using the pod's logs.

❯ cat values.yaml
env:
  - name: ALLOW_EMPTY_PASSWORD
    value: "yes"
  - name: VALKEY_NODES
    value: "nil"

But from here on the pod is stuck in liveliness probe failure resulting in FailedScheduling state. Warning Unhealthy 2m9s (x4 over 3m9s) kubelet Liveness probe failed: Could not connect to Valkey at valkey-test-leader-0:6379: Connection refused

k logs valkey-test-leader-0

.....
valkey-cluster 10:45:02.27 INFO  ==>
valkey-cluster 10:45:02.27 INFO  ==> ** Starting Valkey setup **
valkey-cluster 10:45:02.29 WARN  ==> You set the environment variable ALLOW_EMPTY_PASSWORD=yes. For safety reasons, do not use this flag in a production environment.
valkey-cluster 10:45:02.29 INFO  ==> Initializing Valkey
valkey-cluster 10:45:02.29 INFO  ==> Setting Valkey config file

Did you have any success running the valkey cluster with this or any other operator or any guidelines how we can patch further to make it work for valkey-cluster?

Thanks.

DPS0340 commented 2 months ago

@arpan57

Thanks to notify me about this issue :) As you reported, valkey/valkey:7.2.5-alpine3.19 has no configurations and supports about cluster.

I will going to further investigate about this issue.

Thanks :)

arpan57 commented 2 months ago

Thanks @DPS0340