Introduction
The NodeOrder plugin is responsible for scoring nodes during the scheduling process to find the absolute best node for a pod. Rather than just finding any node that fits the pod’s requirements, NodeOrder ranks the nodes based on configurable scoring dimensions, such as affinity rules or resource availability.
Environment setup
Update scheduler configmap
The nodeorder plugin must be enabled in the scheduler configuration.
kind: ConfigMap
apiVersion: v1
metadata:
name: volcano-scheduler-configmap
namespace: volcano-system
data:
volcano-scheduler.conf: |
actions: "enqueue, allocate, backfill"
tiers:
- plugins:
- name: priority
- name: nodeorder
- name: gang
How to use NodeOrder Plugin
The NodeOrder plugin scores nodes automatically based on built-in Kubernetes concepts like NodeAffinity, PodAffinity, and PodAntiAffinity.
Example YAML
Create a file named nodeorder-job.yaml:
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: nodeorder-job
spec:
minAvailable: 1
schedulerName: volcano
tasks:
- replicas: 3
name: worker
template:
spec:
affinity:
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
matchExpressions:
- key: disktype
operator: In
values:
- ssd
containers:
- image: nginx
name: nginx
resources:
requests:
cpu: "1"
restartPolicy: OnFailure
In this example, the nodeAffinity specifies a preferredDuringSchedulingIgnoredDuringExecution rule. The NodeOrder plugin takes this preference into account. It will give a higher score (boosted by the weight of 100) to any node that has the label disktype=ssd.
Verification
Label one of your nodes with
disktype=ssd:kubectl label nodes <your-node-name> disktype=ssdApply the job:
kubectl apply -f nodeorder-job.yamlCheck where the pods were scheduled:
kubectl get pods -o wide | grep nodeorder-jobYou will observe that the Volcano scheduler strongly prefers to place the pods on the node labeled with
disktype=ssddue to the high score calculated by the NodeOrder plugin.