Sobes.tech
Middle+

How do you determine the values of requests and limits for resources in Kubernetes?

sobes.tech AI

Answer from AI

The values of requests and limits for resources in Kubernetes are determined based on the application's resource consumption analysis and stability requirements.

  • Requests — the minimum guaranteed resources that a pod will receive upon startup. Usually set at the level of the application's average consumption.
  • Limits — the maximum resources that a pod can use. They help restrict consumption and prevent impact on other pods.

To determine these values:

  1. Collect CPU and memory usage metrics under real conditions (e.g., using Prometheus).
  2. Analyze peak and average values.
  3. Set requests slightly above the average consumption to ensure stability.
  4. Set limits at a level that prevents the application from overloading the node, considering peak loads.

Example in a Kubernetes manifest:

resources:
  requests:
    cpu: "100m"
    memory: "200Mi"
  limits:
    cpu: "500m"
    memory: "500Mi"

This approach helps balance resource utilization efficiency and application stability.

How do you determine the values of requests and… - sobes.tech