Jawahar
Jawahar

Reputation: 4885

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?

Upvotes: 2

Views: 259

Answers (2)

Nick_Kh
Nick_Kh

Reputation: 5253

Limits guarantee that the container will never overreach the defined value for a particular resource. You can always set LimitRange whenever you want to define the default request limits for containers within the same namespace, use Min and Max Resource Constraints or even set Memory and CPU Quotas for the particular namespace as described here. There are also some concepts of using Limits for Namespace mentioned in the official Kubernetes documentation.

Upvotes: 0

Ryan Dawson
Ryan Dawson

Reputation: 12558

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.

Upvotes: 2

Related Questions