0

I have an OpenShift Cluster which is spanned between two physical separated datacenters for georedundancy. The nodes are labeled according to their location.

Now i'm searching for a way to configure the scheduler in such a way that if a pod is running with one replica (which is in one of the two datacenters), and an additional replica is started, the additional replica starts in the other datacenters? So that if the deployment is running with an even number of replicas, the replicas are evenly distributed between both datacenters?

I was searching in the pod/node affinity documentation as well as scheduler configuration, but i didn't find anything i need. Maybe i'm just googling wrong?

Any help is greatly appreciated.

simonszu
  • 343
  • 5
  • 14
  • Hi https://docs.openshift.com/container-platform/3.11/admin_guide/scheduling/scheduler.html#configurable-priority-functions It would be helpful – Suresh Vishnoi Apr 09 '19 at 08:33

1 Answers1

1

If you have given a label to the nodes, for instance location, check the labels with the following command

oc get nodes --show-labels

ServiceAntiAffinity takes a label and ensures a good spread of the pods belonging to the same service across the group of nodes based on the label values

Spread across datacenter

you can add the following content inside the /etc/origin/master/scheduler.json file

 {
            "argument": {
                "serviceAntiAffinity": {
                    "label": "location"
                }
            },
            "name": "Location",
            "weight": 2
        }
  • 1
    I have searched kubernetes documentation and stumbled upon [failure-domain.beta.kubernetes.io](https://kubernetes.io/docs/reference/kubernetes-api/labels-annotations-taints/#failure-domainbetakubernetesiozone), which, in addition to SelectorSpreadPolicy in the scheduler seems to resolve my issue as well. Can you tell me the difference between both approaches? – simonszu Apr 09 '19 at 09:51
  • My cluster is on bare metal, thus i do not have any personal experience – Suresh Vishnoi Apr 09 '19 at 10:04