Sobes.tech
Middle

Tell us about requests and limits on pods in Kubernetes.

sobes.tech AI

Answer from AI

In Kubernetes, the parameters requests and limits are used to manage pod resources.

  • requests — this is the minimum amount of resources (CPU, memory) that the pod is guaranteed to receive upon startup. The Kubernetes scheduler uses these values to determine which node to place the pod on.

  • limits — this is the maximum amount of resources that the pod can use. If the pod exceeds this limit for CPU, it will be throttled, and if it exceeds the memory limit, the container may be killed (OOMKilled).

Example configuration in a pod manifest:

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

Here, the pod requests a minimum of 128Mi of memory and 0.25 CPU, but cannot use more than 256Mi of memory and 0.5 CPU.

This helps efficiently allocate cluster resources and prevents situations where one pod consumes too many resources, affecting others.