1.10.8. 扩展资源的资源装箱¶
可以给扩展资源配置分数,辅助调度系统为节点评分,提高打醒集群中稀缺资源的资源利用率
apiVersion: kubescheduler.config.k8s.io/v1beta1
kind: KubeSchedulerConfiguration
profiles:
# ...
pluginConfig:
- name: RequestedToCapacityRatio
args:
shape:
- utilization: 0
score: 10
- utilization: 100
score: 0
resources:
- name: intel.com/foo
weight: 3
- name: intel.com/bar
weight: 5
1.10.8.1. RequestedToCapacityRatioResourceAllocation 优先级函数如何对节点评分¶
请求的资源
intel.com/foo: 2
Memory: 256MB
CPU: 2
资源权重
intel.com/foo: 5
Memory: 1
CPU: 3
FunctionShapePoint {{0, 0}, {100, 10}}
节点 Node 1 配置
可用:
intel.com/foo : 4
Memory : 1 GB
CPU: 8
已用:
intel.com/foo: 1
Memory: 256MB
CPU: 1
节点得分:
intel.com/foo = resourceScoringFunction((2+1),4)
= (100 - ((4-3)*100/4)
= (100 - 25)
= 75
= rawScoringFunction(75)
= 7
Memory = resourceScoringFunction((256+256),1024)
= (100 -((1024-512)*100/1024))
= 50
= rawScoringFunction(50)
= 5
CPU = resourceScoringFunction((2+1),8)
= (100 -((8-3)*100/8))
= 37.5
= rawScoringFunction(37.5)
= 3
NodeScore = (7 * 5) + (5 * 1) + (3 * 3) / (5 + 1 + 3)
= 5