Affinity and Anti-affinity scheduler behaviour in RHOCP 4

Solution Verified - Updated

Environment

  • Openshift Enterprise
    • 3.2

Issue

  • What does affinity and anti-affinity mean in OpenShift scheduling?

Resolution

  • Affinitry rules means if we want to schedule pods on a specific label; for instance, only schedule myApp1 on region east and myApp2 on region west." But you may have, say, three zones in each region, zoneA, zoneB, and zoneC.

  • Setting an anti-affinity means if we want to try to balance my application between the zones." A simplistic example is a pair of buildings each with three rooms, and each room has some number of servers. You want one copy of your app running in each room but only in one of the buildings; keeping them isolated in each room ensures no outage if the power goes out in one room, for instance. Thus, you would set an affinity for one of the buildings, but an anti-affinity so that the applications do not schedule all in the same room.

  • The use cases for this can vary; for instance, if you have two applications, one of which is CPU-heavy and one of which is I/O-heavy, you can ensure that the CPU-heavy and the I/O-heavy apps are scheduled in pairs to balance resources, etc.

SBR
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.