Sobes.tech
Junior — Middle

Can you explain the concepts of limits and resource requests in Kubernetes?

sobes.tech AI

Answer from AI

In Kubernetes, resource limits and requests are used to manage CPU and memory consumption by containers:

  • Requests: This is the minimum amount of resources that a container is guaranteed to receive. The Kubernetes scheduler uses requests to determine on which node to place the pod, based on available resources.

  • Limits: This is the maximum amount of resources that a container can use. If a container exceeds its CPU limit, its usage will be restricted; if it exceeds memory limits, the container may be killed.

Example of configuration in a Pod manifest:

resources:
  requests:
    memory: "128Mi"
    cpu: "250m"
  limits:
    memory: "256Mi"
    cpu: "500m"

Thus, requests help in efficient placement planning, and limits prevent a container from consuming excessive resources, which enhances cluster stability.