IBM / operator-for-redis-cluster

IBM Operator for Redis Cluster
https://ibm.github.io/operator-for-redis-cluster
MIT License
60 stars 34 forks source link

redis-cluster pods not distributing across multiple zones with topology spread constraint enabled for zone #74

Closed TANISH-18 closed 1 year ago

TANISH-18 commented 1 year ago

Hi @cin , i am deploying fed-redis-cluster. even after enabling zone level topology i can see that pods of same shards are not spread across multiple zones.

POD NAME IP NODE ID ZONE USED MEMORY MAX MEMORY KEYS SLOTS

topologySpreadConstraints:

TANISH-18 commented 1 year ago

image

TANISH-18 commented 1 year ago

if you see in the first shard two redis pods are in the same zone ideally it should be in different zone. we have total 4 zone in our cluster and each zone has 3 k8 nodes

cin commented 1 year ago

Thanks for the issue @TANISH-18 and sorry for the delay. This is actually a known issue if you are sharing worker nodes. There's only so much control we have over where the kubernetes scheduler puts pods, so we try to do the best we can. Notice you have one worker with 3 pods scheduled on it and two workers with only one pod scheduled. There's not much we can do to fix that at the operator level. If HA is really your priority, I'd advise against sharing nodes. If a node dies, so do the pods on that worker. So in this case, you'd lose whatever was on the 3 pods on 10.31.48.89.

I actually started looking into some ways to address this and created a PR to investigate -- see #55. So far, what I tried there is only marginally better than the existing logic. The placement logic really needs to be re-written to address this issue, but it gets complicated (see comments on the PR draft). Unfortunately I don't really have the time to address this issue at the moment (due to other work). TBH, I don't really consider this to be a priority because worker nodes shouldn't be shared. I get that you may want to share nodes in non-production environments, but you also don't care about HA as much in those environments.

Sorry I know this is not the answer you wanted to hear, but hopefully understanding the limitation will help you work around it until there is a better solution in place.