koordinator-sh / koordinator

A QoS-based scheduling system brings optimal layout and status to workloads such as microservices, web services, big data jobs, AI jobs, etc.
https://koordinator.sh
Apache License 2.0
1.27k stars 316 forks source link

elastic quota 弹性抢占疑问[question] #2125

Closed zj619 closed 1 week ago

zj619 commented 3 weeks ago

What happened: kubectl create ns namespace1 kubectl create ns namespace2 相关配置 image 创建队列 image 队列配置文件如下 root.yml apiVersion: scheduling.sigs.k8s.io/v1alpha1 kind: ElasticQuota metadata: name: root labels: quota.scheduling.koordinator.sh/is-parent: "true" quota.scheduling.koordinator.sh/allow-lent-resource: "true" spec: max: cpu: 2 memory: 2Gi min: cpu: 2 memory: 2Gi

queue-a.yml apiVersion: scheduling.sigs.k8s.io/v1alpha1 kind: ElasticQuota metadata: name: a namespace: namespace1 labels: quota.scheduling.koordinator.sh/parent: "root" quota.scheduling.koordinator.sh/is-parent: "false" quota.scheduling.koordinator.sh/allow-lent-resource: "true" annotations: quota.scheduling.koordinator.sh/shared-weight: '{"cpu":"1","memory":"1Gi"}' spec: max: cpu: 2 memory: 2Gi min: cpu: 1 memory: 1Gi

queue-b.yaml apiVersion: scheduling.sigs.k8s.io/v1alpha1 kind: ElasticQuota metadata: name: b namespace: namespace2 labels: quota.scheduling.koordinator.sh/parent: "root" quota.scheduling.koordinator.sh/is-parent: "false" quota.scheduling.koordinator.sh/allow-lent-resource: "true" annotations: quota.scheduling.koordinator.sh/shared-weight: '{"cpu":"1","memory":"1Gi"}' spec: max: cpu: 2 memory: 2Gi min: cpu: 1 memory: 1Gi

先运行pod-a.yaml,qos等级为BE apiVersion: v1 kind: Pod metadata: name: pod-a namespace: namespace1 labels: quota.scheduling.koordinator.sh/name: "a" koordinator.sh/qosClass: BE #qos spec: schedulerName: koord-scheduler priorityClassName: koord-batch containers:

再次运行pod-d.yaml,qos等级为LSE apiVersion: v1 kind: Pod metadata: name: pod-d namespace: namespace2 labels: quota.scheduling.koordinator.sh/name: "b" koordinator.sh/qosClass: "LSE" spec: schedulerName: koord-scheduler priorityClassName: koord-prod containers:

结果如下,pod-a和pod-d都running image

再运行一个qos等级为LSE的pod-e,不能抢占pod-a的资源 image

pod-e.yaml apiVersion: v1 kind: Pod metadata: name: pod-e namespace: namespace2 labels: quota.scheduling.koordinator.sh/name: "b" koordinator.sh/qosClass: "LSE" spec: schedulerName: koord-scheduler priorityClassName: koord-prod containers:

为什么pod-e不会抢占pod-a的资源 ~

What you expected to happen:

Environment:

Anything else we need to know:

saintube commented 3 weeks ago

PTAL @shaloulcy

saintube commented 2 weeks ago

@zj619 It seems the pod-e is firstly admitted by the quota-b and rejected due to exceeding the quota min.

zj619 commented 1 week ago

@zj619 It seems the pod-e is firstly admitted by the quota-b and rejected due to exceeding the quota min. 高qos的不是能抢占低qos的资源吗,为什么pod-e没有抢占pod-a的资源

saintube commented 1 week ago

@zj619 It seems the pod-e is firstly admitted by the quota-b and rejected due to exceeding the quota min. 高qos的不是能抢占低qos的资源吗,为什么pod-e没有抢占pod-a的资源

首先,pod-e 的调度需要满足叶子节点的限制。否则,即使 pod-a 被抢占,pod-e 因为叶子结点超限也无法调度。