Getting Started with Containerization
上QQ阅读APP看书,第一时间看更新

Affinity and location awareness

Sometimes, certain application services require the availability of dedicated hardware on the nodes they run on. For example I/O-bound services require cluster nodes with an attached high-performance solid-state drive (SSD), or some services require an Accelerated Processing Unit (APU). Orchestrators allow us to define node affinities per application service. The orchestrator will then make sure that its scheduler only schedules containers on cluster nodes that fulfill the required criteria.

Defining an affinity to a particular node should be avoided; this would introduce a single point of failure and thus compromise high availability. Always define a set of multiple cluster nodes as the target for an application service.

Some orchestration engines also support what is called location awareness or geo-awareness. What this means is that one can request the orchestrator to equally distribute instances of a service over a set of different locations. One could, for example, define a label datacenter with the possible values west, center, and east and apply the label to all cluster nodes with the value that corresponds to the geographical region in which the respective node is located. Then, one instructs the orchestrator to use this label for geo-awareness of a certain application service. In this case, if one requests nine replicas of the service, the orchestrator would make sure that three instances are deployed to nodes in each of the three data centers, west, center, and east.

Geo-awareness can even be defined hierarchically; for example, one can have a data center as the top-level discriminator, followed by the availability zone and then the server rack.

Geo-awareness or location awareness is used to decrease the probability of outages due to power supply failures or data center outages. If the application instances are distributed across server racks, availability zones, or even data centers, it is extremely unlikely that everything goes down at once. One region will always be available.