Skip to main content

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: The nodeName and nodeSelector options allow a Pod 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 the Pod is scheduled only on nodes that have the label net: fast applied to them. All listed nodeSelector must be met to be scheduled (but the node might have more labels). The Pod would remain Pending if not.

spec:
containers:
- name: redis
image: redis
nodeSelector:
net: fast
  • affinity: affinity and anti-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. Each Pod could then include a schedulerName to choose which schedule to use.
  • tolerations: The use of taints allows a node to be labeled such that Pods would not be scheduled for some reason, such as the master node after initialization. A toleration allows a Pod to ignore the taint and be scheduled assuming other requirements are met.