ACS clusters include a default scheduler. When you submit a pod to a cluster, the scheduler named default-scheduler allocates resources by default. To schedule special resource types and implement complex scheduling policies, ACS clusters allow you to use a custom scheduler for pods. This topic describes how to use a custom scheduler in an ACS cluster and its constraints.
Prerequisites
The pod compute type is High-Performance Network GPU (gpu-hpn).
The acs-virtual-node add-on is installed, and its version is v2.12.0-acs.8 or later.
The kube-scheduler component is installed, and its version meets the following requirements.
ACS cluster version
kube-scheduler version that supports custom schedulers
1.32 and later
All versions are supported.
1.31
v1.31.0-aliyun-1.1.2 and later.
1.30
v1.30.3-aliyun-1.1.2 and later.
1.28
v1.28.9-aliyun-1.1.2 and later.
NoteWhen you use a custom scheduler for a GPU-HPN pod, you must configure the
spec.schedulerNamefield for the pod. For more information, see Specify schedulers for pods.
Precautions
In an ACS cluster, pods with different compute types use different node types. ACS does not support custom schedulers for pod types that use regular virtual nodes. The details are as follows.
Compute type | Corresponding node type | Use custom scheduler |
General-purpose | Regular virtual node | Not supported |
Compute-optimized | ||
GPU | ||
GPU-HPN | GPU-HPN reserved node | Supported |
Procedure
Step 1: Deploy a custom scheduler in the ACS cluster
Deploy a custom scheduler in the cluster. For more information, see the Kubernetes documentation.
Step 2: Modify the ACS scheduler configuration
Log on to the ACS console. In the left-side navigation pane, click Clusters.
On the Clusters page, find the target cluster and click its ID. In the left navigation pane, choose .
On the Add-ons page, on the Kube Scheduler card, click Configuration.
In the dialog box that appears, select Enable custom labels and schedulers for GPU-HPN nodes, and then click OK.
The following table describes the effects on pods and nodes when this option is enabled or disabled.
NoteThis applies only to GPU-HPN pods and nodes. Other pod compute types do not support custom schedulers.
Using the default scheduler (option disabled)
Using a custom scheduler (option enabled)
Pod scheduler name
Customization is not supported. After you submit a pod, the
spec.schedulerNamefield is changed to default-scheduler.Customization is supported. You can set the
spec.schedulerNamefield of the pod to any value. The field is not modified after submission.Pod scheduling process
The ACS default scheduler allocates resources for all pods.
The ACS default scheduler only schedules pods where
spec.schedulerNameis set to default-scheduler. Custom schedulers allocate resources for all other pods.GPU-HPN node label and taint constraints
Adding, modifying, and deleting node labels, annotations, and taints are subject to ACS configuration constraints. For more information, see Manage node labels and taints.
Adding, modifying, and deleting node labels, annotations, and taints are no longer subject to ACS configuration constraints.
Pod affinity scheduling constraints
The configuration of affinity fields is subject to ACS configuration constraints. For more information, see Node affinity scheduling.
The configuration of affinity fields is no longer subject to ACS configuration constraints.
Step 3: Configure a custom scheduler for a pod
Create a file named
dep-with-koordinator.yamlwith the following content.The file describes a deployment. The pod template specifies a custom scheduler named
koord-scheduler.apiVersion: apps/v1 kind: Deployment metadata: name: dep-with-koordinator labels: app: dep-with-koordinator spec: replicas: 1 selector: matchLabels: app: dep-with-koordinator template: metadata: labels: app: dep-with-koordinator # Set the compute class to gpu-hpn. Other compute types do not support custom schedulers. alibabacloud.com/compute-class: gpu-hpn spec: containers: - name: demo image: registry.cn-hangzhou-finance.aliyuncs.com/acs/stress:v1.0.4 command: - "sleep" - "infinity" restartPolicy: Always # Set the scheduler name to koord-scheduler. The name must match the one configured in Step 1. schedulerName: koord-schedulerSubmit the pod to the ACS cluster.
kubectl apply -f dep-with-koordinator.yamlCheck the configured
schedulerNameof the pod.kubectl get pod -lapp=dep-with-koordinator -o custom-columns=NAME:.metadata.name,schedulerName:.spec.schedulerNameExpected output:
# The pod specifies the custom scheduler named koord-scheduler. NAME schedulerName dep-with-koordinator-xxxxx-xxxxx koord-scheduler
FAQ
Why do I receive an Insufficient attachable-volumes-xxx error during scheduling when a pod uses a PVC resource with a custom scheduler?
This issue does not occur with the default Kubernetes scheduler. This is because some custom schedulers have specific requirements for processing PersistentVolumeClaim (PVC) resources. They require the node's Container Storage Interface (CSI) Node object to exist and to have reported the capacity information for the corresponding CSI driver. If the node does not meet these conditions, the scheduler reports an insufficient resource error.
To resolve this issue, you can configure the scheduler to ignore specific CSI drivers. For example, with the Volcano scheduler, you can add the `--ignored-provisioners=${csi-driver-name}` parameter at startup:
# You can specify multiple drivers, separated by commas.
--ignored-provisioners=povplugin.csi.alibabacloud.comAdjust the configuration parameter based on the name of the CSI driver you are using.