Pod资源需求和资源限制
[root@master resource]# kubectl apply -f resource-requests-demo.yaml
[root@master resource]# cat resource-requests-demo.yaml
apiVersion: v1
kind: Pod
metadata:
name: stress-pod
spec:
containers:
- name: stress
image: ikubernetes/stress-ng
command: ["/usr/bin/stress-ng","-c 1", "-m 1", "--metrics-brief"]
resources:
requests:
memory: "128Mi"
cpu: "200m"
# limits:
# memory: "512Mi"
# cpu: "400m"
CPU使用率是48%,因为我的node是2颗CPU,这个容器最多只能跑满一颗核心
内存 262M 代表这个进程限制了 最多占用这么多
[root@master resource]# cat resource-requests-demo.yaml
apiVersion: v1
kind: Pod
metadata:
name: stress-pod
spec:
containers:
- name: stress
image: ikubernetes/stress-ng
command: ["/usr/bin/stress-ng","-c 1", "-m 1", "--metrics-brief"]
resources:
requests:
memory: "128Mi"
cpu: "200m"
limits:
memory: "512Mi"
cpu: "500m"