55 lines
1.2 KiB
Markdown
55 lines
1.2 KiB
Markdown
requests: 保底的资源要求
|
||
limits:资源上限
|
||
包括以下资源
|
||
cpu
|
||
memory
|
||
Ephemeral storage 【Ephemeral,短暂的】
|
||
extended-resouce:如nvidia.com/gpu
|
||
|
||
|
||
pod Qos 服务质量
|
||
Guaranteed 高,保障,request==limit
|
||
Burstable,中,弹性 cpu/memory request与limit不相等
|
||
bestEffort,低,尽力而为。所有资源的request与limit都不填
|
||
|
||
k8s是使用隐性 Qos
|
||
|
||
不同的Qos调度不同
|
||
1、调度器会使用request进行调度
|
||
cpu按照该request划分权重
|
||
--cpu-manager-policy=static,Guaranteed整数会绑核
|
||
|
||
memory按Qos的OOMScore(得分越高,在node内存溢出以后,会优先剔除)
|
||
Guaranteed -998
|
||
Burstable 2-999
|
||
bestEffort 1000
|
||
|
||
Eviction(驱逐)
|
||
优先驱逐bestEffort
|
||
Kubelet - CPUManager
|
||
|
||
|
||
ResoureQuota【quota限制】
|
||
限制每个namespace 的资源用量
|
||
限制demo-ns namespace下非BestEffort Qos的Quota
|
||
cpu只能使用1000个
|
||
memory只能使用200Gi
|
||
pod只能创建10个
|
||
当Quota使用超过后,禁止创建
|
||
|
||
|
||
apiVersion: v1
|
||
kind: ResourceQuota
|
||
metadata:
|
||
name: demo-quota
|
||
namespace: demo-ns
|
||
|
||
spec:
|
||
hard:
|
||
cpu: "1000"
|
||
memory: 200Gi
|
||
pods: "10"
|
||
scopeSelector: # 可以不填
|
||
matchExpressions:
|
||
- operator: Exists
|
||
scopeName: NotBestEffort
|