Pod Scheduling
Pod scheduling is a key concept in Kubernetes that determines how pods are assigned to nodes in a cluster.
In PAS-X, pod scheduling is crucial for ensuring that the application runs efficiently and effectively across the available nodes in a Kubernetes cluster. Specifically, it allows PAS-X to control where its pods, jobs, and Argo workflow pods are scheduled based on the characteristics of the nodes and the requirements of the application, such as resource availability.
There are two concepts of Kubernetes used in PAS-X to Assign Pods to Nodes: Node Affinity and Taints and Tolerations to schedule pods and jobs.
- Node Affinity
-
Nodes are labeled so PAS-X can schedule pods to specific nodes. The affinity can be set to
preferredorrequired. If nodes are onlypreferred, additional nodes can be used for scheduling PAS-X pods if resources are too limited. If nodes arerequired, PAS-X pods will only be scheduled on nodes with the specified labels. - Taints and Tolerations
-
Nodes are tainted to prevent pods from being scheduled on them. PAS-X Pods will have tolerations for these taints, allowing them to be scheduled on nodes with specific taints.
Scheduling PAS-X Pods
PAS-X pods can be scheduled on specific nodes in a Kubernetes cluster based on the node’s labels and taints.
Additionally, PAS-X service-specific pods can be assigned to different service groups, enabling more precise scheduling and resource management.
Pod scheduling also applies to PAS-X installation workflow pods created by the mes-workflows Helm chart.
This ensures that Argo workflow execution pods can be scheduled on PAS-X nodes when those nodes use PAS-X taints.
PAS-X pod scheduling is optional and must be enabled in the PAS-X configuration.
podScheduling.enabled=true|false
-
If set to
true, Kubernetes will start scheduling PAS-X and/or Argo Workflow pods on specified nodes in the cluster. -
If set to
falseKubernetes will schedule PAS-X Pods on any available node in the cluster.
PAS-X pod scheduling uses by default a soft strategy to schedule pods to a set of preferred nodes. If a node group does not have enough resources to schedule a pod, the scheduler will try to schedule the pod on any available node in the cluster.
This behaviour could be set to a hard handling to require nodes for all PAS-X Pods or if enabled for a specific group. If the pod cannot be scheduled due to resource constraints on eligible nodes, it will not be scheduled at all.
The strategy for scheduling PAS-X pods can be set in the PAS-X configuration.
podScheduling.strategy=preferred-nodes|required-nodes
PAS-X Nodes and Service Groups
PAS-X Nodes
If the property podScheduling.enabled is set to true, each node in the cluster which should be used for scheduling PAS-X pods must have the label node.pasx.io/mes and the taint node.pasx.io/mes:NoSchedule.
The label is used to identify the node as a PAS-X node so that all PAS-X pods can find the nodes they are interested in. The taint is used to prevent other non PAS-X pods from being scheduled on it.
In addition, a PAS-X node can also be part of a more specialized service group, which is explained in the next section.
PAS-X Service Groups
You can add more labels and taints to create specialized service groups.
These labels and taints have the key node.pasx.io/service.mes and as a value the name of the service group.
The value is identical to the name of the service, e.g. central for the central service group or report-printing for the report printing service group.
These specific groups should only be used for resource-intensive PAS-X services, such as the central service group, which requires more resources than other PAS-X services. Report printing could be another candidate, as the resource requirements of the service depend on the number of pages of a report printed by PAS-X.
Labels and taints of PAS-X MES
-
All PAS-X MES nodes need the general label and taint.
# Label
node.pasx.io/mes=""
# Taint
node.pasx.io/mes=NoSchedule
|
According to the official documentation, the |
|
The |
-
To create a central service groups the specific nodes need an additional label and taint.
# Label
node.pasx.io/service.mes="central"
# Taint
node.pasx.io/service.mes="central":NoSchedule
-
Optionally for other services like the report printing service group further groups could be created.
# Label
node.pasx.io/service.mes="report-printing"
# Taint
node.pasx.io/service.mes="report-printing":NoSchedule
|
PAS-X MES nodes should not have any other custom taints set that could interfere with the scheduling of pods. Taints set temporarily by Kubernetes for Taint based Evictions, such as |
|
It is not recommended to use more than a specific central service group. |
|
Single Node cluster. If a single-node cluster is used to run PAS-X, the pod scheduling feature must be deactivated: See also Well-Known Labels, Annotations and Taints - |
|
PAS-X MES Pods use the Kubernetes standard, for more information about pod scheduling |
Setup of PAS-X Nodes
The following steps are required to set up PAS-X nodes in a Kubernetes cluster. This is typically done by the create cluster infrastructure function.
-
For all PAS-X Nodes set the label and taint on all nodes which should be used for PAS-X pods. General PAS-X nodes have the key
node.pasx.io/mesand an empty value.
kubectl label node "a-node-name" node.pasx.io/mes=""
kubectl taint node "a-node-name" node.pasx.io/mes:NoSchedule
-
To create a service group
centralset the label and taint on all nodes which should be used for the central service group.-
Service groups have the key
node.pasx.io/service.mesand the value of the service group, e.g.central.
-
kubectl label node "a-node-name" node.pasx.io/service.mes="central"
kubectl taint node "a-node-name" node.pasx.io/service.mes=central:NoSchedule
PAS-X Pods Anti-Affinity
If the PAS-X pod scheduling is enabled, PAS-X pods are deployed with an inter-pod anti-affinity. The anti-affinity is set to pods of the same type, e.g. all PAS-X central pods.
The anti-affinity is set in a soft scheduling behavior with preferredDuringSchedulingIgnoredDuringExecution to allow the Kubernetes scheduler to place pods on the same node if needed, e.g. scheduling more label print services than available nodes.
To learn more about the anti-affinity, see the Inter-Pod Affinity and Anti-Affinity Kubernetes documentation.
|
Pod anti-affinity requires nodes to be consistently labeled, in other words, every node in the cluster must have an appropriate label matching topologyKey kubernetes.io/hostname. If some or all nodes are missing the specified topologyKey label, it can lead to unintended behavior. For standard Kubernetes clusters, the |