容器的资源需求,资源限制
- requests:需求,最低保障;
- limits:限制,硬限制;
CPU:
1 颗逻辑 CPU
1=1000,millicores
500m=0.5CPU
QoS:
- Guranteed : 每个容器 同时设置CPU和内存的requests和limits
即 :cpU.limits=cpu.request, memory.limits=memory.requests - Burstable:至少有一个容器设置CPU或内存资源的requests属性
- BestEffort:没有任何一个容器设置了requests或limits属性
# 查看节点上的 taint
kubectl describe nodes node1 |grep -E '(Roles|Taints)'
kubectl describe nodes node2 |grep -E '(Roles|Taints)'
kubectl taint node node1 node-type-
kubectl taint node node2 node-type-
mkdir ~/metrics ; cd ~/metrics
vi pod-demo.yaml
apiVersion: v1
kind: Pod
metadata:
name: pod-demo
labels:
app: myapp
tier: frontend
spec:
containers:
- name: myapp
image: ikubernetes/stress-ng
command: ["/usr/bin/stress-ng", "-c 1", "--metrics-brief"]
resources:
requests:
cpu: "200m"
memory: "128Mi"
limits:
cpu: "500m"
memory: "512Mi"
kubectl apply -f pod-demo.yaml
kubectl exec pod-demo -- top
# 查看 Qos
kubectl describe pod pod-demo|grep "QoS Class"
所有评论(0)