Back to results for “Architecture”
Redis › Redis with Docker & Kubernetes

What resource requests and limits should you configure for a Redis pod running on Kubernetes, and why does this matter?

Intermediate

Answer

You should set memory requests and limits based on your expected dataset size plus a reasonable buffer for overhead, ensuring Kubernetes reserves adequate memory for the pod and prevents Redis from being unexpectedly killed due to exceeding its allocated resources, while also setting appropriate CPU requests to ensure the pod receives consistent processing time even on a busy, shared cluster node.
resources:
  requests:
    memory: '2Gi'
    cpu: '500m'
  limits:
    memory: '4Gi'
    cpu: '1000m'
Real-world example A team deploying Redis on a shared Kubernetes cluster carefully sets memory limits with sufficient headroom above their expected dataset size, preventing Kubernetes from terminating the Redis pod during a brief, temporary spike in memory usage.

Common follow-ups: What happens if a Redis pod exceeds its configured memory limit on Kubernetes?;How do you calculate an appropriate memory limit accounting for both data and overhead?