Openshift scheduler Affinity

6/14/2018

I have a openshift cluster and want my pods when scaled more than 1 to end up on different nodes based on zone label. For example half of my nodes have zone=EU and another half zone=US. Every time I scale up pods to 2 they are beinf placed little random, sometimes end up on US,US sometimes EU,US and EU,EU.

What I want is always to be EU,US or US,EU.

I use default /etc/origin/master/scheduler.json which at the bottom has this

        "argument": {
            "serviceAntiAffinity": {
                "label": "zone"
            }
        },
        "name": "Zone",
        "weight": 2
    }
]

Any ideas how I can achieve what I want?

-- bortek
kubernetes
openshift

1 Answer

6/15/2018

Take a look at pod anti-affinity. You may try to use preferredDuringSchedulingIgnoredDuringExecution and try to create rules for distributing your pods.

-- Nick Rak
Source: StackOverflow