Search code examples
kubernetescontainersmicroservices

What is the purpose of resource limit in Kubernetes?


It is known that if a pod consumed more resource than request, it is likely to be evicted or terminated. What is the purpose of resource limit then? Is it like a grace period?

  resources: 
    requests:
      cpu: "100m"
    limits:
      cpu: "200m"

I didn't see a clear documentation for this in Kubernetes official doc. Can anyone clarify this?


Solution

  • Request guarantees a minimum amount of resource, which the scheduler does by ensuring the node that the Pod is scheduled to has space for it. Limit is a maximum over which a Pod is like to be killed.

    I personally find the google kubernetes documentation clearer on this than the official kubernetes one.