Balancing redis cluster between 2 regions

6/24/2019

I have a 6 node redis cluster in a stateful set. The first 3 nodes are the masters and the next 3 nodes are the replicas. I'm currently using a nodeSelector to specify which region I want my nodes to exist. This works fine, but I'd like to have my masters in one region and the replicas in another region. Is this possible to setup using nodeAffinity or podAntiAffinity?

If I do a describe pods, I can see that there is a "statefulset.kubernetes.io/pod-name" label with the value being "redis-cluster-#" where # is [0-5]. I should be able to use that in my matchExpressions in the yaml, but I can't see how to set it up so the first 3 go to one region and the next 3 go to another.

-- rpena
kubernetes
kubernetes-pod
openshift

0 Answers