查看当前Node 的 capacity
Capacity:
cpu: 4
ephemeral-storage: 50824704Ki
hugepages-1Gi: 0
hugepages-2Mi: 0
memory: 8123340Ki
pods: 110
如果要在上述 status 字段里添加新的 capacity ,必须使用 PATCH API
启动proxy
kubectl proxy
添加新的 capacity
curl --header "Content-Type: application/json-patch+json" \
--request PATCH \
--data '[{"op": "add", "path": "/status/capacity/studyk8s.com~1lizhe", "value": "4"}]' \
http://localhost:8001/api/v1/nodes/k1/status
curl --header "Content-Type: application/json-patch+json" \
--request PATCH \
--data '[{"op": "remove", "path": "/status/capacity/studyk8s.com~1lizhe"}]' \
http://localhost:8001/api/v1/nodes/k1/status
上面代码会生成 studyk8s.com/lizhe: 4
然后就可以在dep中使用
resources:
limits:
studyk8s.com/lizhe: 4
这样 studyk8s.com/lizhe 就成为了一种资源
因为只有node1带有这种资源,而且已经被耗尽了,所以无法部署多个