3.4.15. LimitRange.yml¶
相关参考: ResourceQuota
说明:
cpu: 500m // 500 millicpus
等同
cpu: "0.5"
LimitRange是namespace级别的, 即在namespace中有一个LimitRange, 则此namespace下创建pod时会自动加上LimitRange上的限制。
apiVersion: v1
kind: LimitRange
metadata:
name: example
spec:
limits:
- type: Pod
min:
cpu: 50m
memory: 5Mi
max:
cpu: 1
memory: 1Gi
- type: Container
defaultRequest:
cpu: 100m
memory: 10Mi
default:
cpu: 200m
memory: 100Mi
min:
cpu: 50m
memory: 5Mi
max:
cpu: 1
memory: 1Gi
maxLimitRequestRatio:
cpu: 4
memory: 10
- type: PersistentVolumeClaim
min:
storage: 1Gi
max:
storage: 10Gi
QoS等级¶
Guaranteed:
优先级最高
设备request和limit并设置相等 --> QoS=Guaranteed
BestEffort:
优先级最低
未设置request和limit --> QoS=BestEffort
Burstable:
其他情况 --> QoS=Burstable
内存不足时哪个进程会被杀死:
BestEffort -> Burstable -> Guaranteed