Kubernetes中的计算资源管理
容器内运行 top
kubectl exec -it requests-pod top
Mem: 369767748K used, 26208028K free, 51000K shrd, 3765588K buff, 294978160K cached
CPU: 3.1% usr 1.5% sys 0.0% nic 95.2% idle 0.0% io 0.0% irq 0.0% sirq
Load average: 1.44 1.65 1.66 4/6602 18
PID PPID USER STAT VSZ %VSZ CPU %CPU COMMAND
1 0 root R 1308 0.0 27 2.5 dd if /dev/zero of /dev/null
13 0 root R 1324 0.0 38 0.0 top
★ 在容器内看到的 CPU 和内存是节点的。
top 命令显示占用了 2.5% CPU,对于 40 核的系统来说显然是占用了一个核。requests 不会限制资源的使用数量,因为是单线程,最多也就能用满一个核。
容器内运行 top kubectl exec -it limits-pod top Mem: 370581688K used, 25394088K free, 50976K shrd, 3774664K buff, 292993444K cached