In a Kubernetes cluster, scheduling refers to the process in which the scheduling component named kube-scheduler schedules pods to nodes based on the total amount of resources of the cluster. Alibaba Cloud Container Compute Service (ACS) clusters provide resources in the form of virtual nodes. This way, you do not need to consider complex resource allocation policies. You can focus on the application orchestration rules. This topic describes the usage of and precautions for the commonly used scheduling policies in ACS clusters.
Kubernetes-native scheduling policies
The Kubernetes native scheduler provides a variety of scheduling plug-ins. In the virtual nodes of ACS, you can focus on affinity-related policies to ensure application performance and high availability, including the use of topology spread constraints for distributing pods across zones, node affinity, and inter-pod affinity.
Policy | Description | Reference |
Use topology spread constraints to distribute pods across zones | You can specify a label for a virtual node in the TopologyKey field to distribute workloads across zones. | Use topology spread constraints to distribute pods across zones |
Node affinity | Labels are added to virtual nodes to indicate the various attributes of the nodes, such as zones. By describing the affinity requirements in fields, such as nodeSelector, you can run your application on a virtual node that has specific attributes. | |
Inter-pod affinity | This policy is used to express affinity preferences between pods. Compared with node affinity, this policy limits the nodes to which pods can be scheduled based on the labels of pods that are already running on nodes. You can schedule pods to a specific topology domain by describing the affinity requirements in fields such as podAffinity. |
Resource scheduling based on custom priorities
Policy | Description | Scenario | Reference |
Resource scheduling based on custom priorities | You can specify multiple compute classes or compute QoS classes for the pods that you want to create. When resources are out of stock, the scheduler attempts to create pods of other types. | Prioritize the use of a certain type of application. For example, compute jobs may prefer to use best-effort instances that are more cost-effective. |
Job scheduling
In Kubernetes clusters, applications that run jobs have diverse resource requirements. For example, AI training jobs require that a group of pods can apply for resources at the same time. In clusters in which a large number of applications are deployed, resource capacity management is also required. ACS provides the following scheduling policies for applications that run jobs.
Policy | Description | Scenario | Reference |
Gang scheduling | Resources must be allocated to a group of pods as a batch to ensure that all pods can request resources at the same time. If the scheduling requirements are not met, all pods remain in the Pending state. | High-performance computing and AI training jobs, such as Message Passing Interface (MPI) jobs. Applications can run only if you start all replicas. | |
Capacity Scheduling | This policy allows the ACS cluster to impose resource capacity limits for specific namespaces. | If multiple users or applications share the same cluster, you must limit resource usage by namespace. |