Pod_Specification
Pod Specification
Most scheduling decisions can be made as part of a Pod specification. The different fields that control scheduling are:
-
nodeName/nodeSelector: ThenodeNameandnodeSelectoroptions allow aPodto be assigned to a single node or a group of nodes with particular labels.A
Podspecification such as the one below would ensure that thePodis scheduled only on nodes that have the labelnet: fastapplied to them. All listednodeSelectormust be met to be scheduled (but the node might have more labels). ThePodwould remainPendingif not.
spec:
containers:
- name: redis
image: redis
nodeSelector:
net: fast
affinity:affinityandanti-affinitycan be used to require or prefer which node is used by the scheduler. If using a preference instead, a matching node is chosen first, but other nodes would be used if no match is present.schedulerName: Should none of the options above meet the needs of the cluster, there is also the ability to deploy a custom scheduler. EachPodcould then include aschedulerNameto choose which schedule to use.tolerations: The use oftaintsallows a node to be labeled such thatPods would not be scheduled for some reason, such as the master node after initialization. Atolerationallows aPodto ignore thetaintand be scheduled assuming other requirements are met.