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
: ThenodeName
andnodeSelector
options allow aPod
to be assigned to a single node or a group of nodes with particular labels.A
Pod
specification such as the one below would ensure that thePod
is scheduled only on nodes that have the labelnet: fast
applied to them. All listednodeSelector
must be met to be scheduled (but the node might have more labels). ThePod
would remainPending
if not.
spec:
containers:
- name: redis
image: redis
nodeSelector:
net: fast
affinity
:affinity
andanti-affinity
can 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. EachPod
could then include aschedulerName
to choose which schedule to use.tolerations
: The use oftaints
allows a node to be labeled such thatPod
s would not be scheduled for some reason, such as the master node after initialization. Atoleration
allows aPod
to ignore thetaint
and be scheduled assuming other requirements are met.