Sobes.tech
Middle

What are requests and limits in Kubernetes? What is the difference between them?

sobes.tech AI

Answer from AI

In Kubernetes, requests and limits are resource management parameters for containers.

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

  • limits — the maximum amount of resources the container can use. If the container exceeds the CPU limit, its performance will be limited; if it exceeds the memory limit, the container may be killed.

Difference:

  • requests affect scheduling and guarantee minimum resources.
  • limits restrict maximum resource consumption during operation.

Example:

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