1.Score算法
1.1noderesources.BalancedAllocationName
节点cpu使用百分比和内存使用百分比越接近,说明资源使用越均衡,节点分linux系统数越高
1.18版本
源码解析
1.22版本
源码截图
1.2imagelocality
选择已经存在Pod运行所需容器镜像的节点。
检查Node是否存在Pod所需镜像:如果不存在,返回0分linux操作系统基础知识;如果存在,则镜像越大得分越高。
同时,如果一个pod中有两个容器镜像,如果linux操作系统基础知识节点上两个镜像都存在的节点分数〉节点上只有一个镜像的分数
那么有相同镜像数量的节点的分数就是相同的
会考虑镜像在每个节点的分布情况,避免每次都选择同一个节点。
// scaledImageScore returns an adaptively scaled score for the given state of an image.
// The size of the image is used as the base score, scaled by a factor which considers how much nodes the image has "spread" to.
// This heuristic aims to mitigate the undesirable "node heating problem", i.e., pods get assigned to the same or
// a few nodes due to image locality.
源码
1.3noderesourcelinux系统安装s.LeastAllocatedName
资源Requested越小的节点,即资源剩余越多的节点,分数越大
1.4nodapschedulereaffinity.schedule是什么意思英语Name
节点硬亲和通过linux重启命令filter过滤掉了apscheduler
节点软亲和,可以写多个亲和策略
affinity#亲和性
nodeAffinity#node亲和性
preferredDuringSchedulingIgnoredDuringExecution
weight 1 #权重,权重越大越亲和(多个软策略的情况)
preference
matchExpressions
key kubernetes.io/hostname
operator In
values
k8s-node03 # 期望是node03
1.5nodepreferavoidpods.Name
1.6podtopologyspread.Name
有点复杂,后面补充
1.7tainttoleration.Name
spec
tolerations#containers同级
key"check" #能容忍的污点key
operator"Equal" #Equal等于表示key=value , Exists不等于,表示当值不等于下面value正常
value"guozige" #值
effect"PreferNoSchedule" #effect策略
tolerationSeconds 3600 #原始的pod多久驱逐,注意只有effect: "NoExecute"才能设置,不然报错
通过filter过滤掉pod没有容忍node上污点的节点
通过scolinux是什么操作系统re来linux常用命令处理effect:"PreferNoSchedule"#effect策略这种污点的节点分数
参考文献
httpsschedule发音怎么读://zhuanlan.zhihu.com/p/27754017
https://kubernetes.io/zh/docs/reference/sclinux是什么操作系统heduling/config/#scheduling-plugins
发表评论