Allocate or Limit resource for pods in Kubernetes?

后端 未结 2 809
一整个雨季
一整个雨季 2021-02-02 01:31

The resource limit of Pod has been set as:

resource
  limit
    cpu: 500m
    memory: 5Gi

and there\'s 10G mem left on the node.

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-02 01:49

    Kubernetes resource specifications have two fields, request and limit.

    limits place a cap on how much of a resource a container can use. For memory, if a container goes above its limits, it will be OOM killed. For CPU, its usage may be throttled.

    requests are different in that they ensure the node that the pod is put on has at least that much capacity available for it. If you want to make sure that your pods will be able to grow to a particular size without the node running out of resources, specify a request of that size. This will limit how many pods you can schedule, though -- a 10G node will only be able to fit 2 pods with a 5G memory request.

提交回复
热议问题