更多kubernetes文章:
k8s专栏目录
1.创建namespace gpu
2.增加限制
[root@tensorflow1 gpu-namespace]# cat compute-resources.yaml
apiVersion: v1
kind: ResourceQuota
metadata:
name: compute-resources
namespace: gpu
spec:
hard:
pods: "5"
requests.cpu: "1"
requests.memory: 1Gi
limits.cpu: "2"
limits.memory: 2Gi
[root@tensorflow1 gpu-namespace]# kubectl describe namespace gpu
Name: gpu
Labels: <none>
Annotations: <none>
Status: Active
Resource Quotas
Name: compute-resources
Resource Used Hard
-------- --- ---
limits.cpu 0 2
limits.memory 0 2Gi
pods 4 5
requests.cpu 0 1
requests.memory 0 1Gi
No resource limits.
3.检查限制情况
在已经创建好容器的情况下再增加限制,发现限制并没有起作用,预期是memory限制到2g,结果是 从容器内仍然能看到8g内存
容器内:
root@tensorflow-ps-rc-cm9c8:/notebooks# free -m
total used free shared buff/cache available
Mem: &

本文探讨了在 Kubernetes 中为 namespace 设置资源限制的过程,通过创建 ResourceQuota 文件来约束 GPU namespace 中的 CPU 和内存使用。然而,发现设置的限制在已运行的容器中并未生效,内存仍显示为8GB。在重新配置限制并重启容器后,成功限制了单个容器的内存至1G,但仍有容器因未满足限制无法启动。这展示了 Kubernetes 资源限制的实施细节及其挑战。
最低0.47元/天 解锁文章
2319

被折叠的 条评论
为什么被折叠?



