0
0
Kubernetesdevops~3 mins

Why Resource requests and limits in Kubernetes? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if one app could silently crash your whole system? Learn how to stop that with resource limits!

The Scenario

Imagine running many apps on a shared computer without telling it how much memory or CPU each app needs. Sometimes one app uses too much, making others slow or crash.

The Problem

Without setting resource limits, apps can hog all the CPU or memory. This causes slowdowns, crashes, and unpredictable behavior. Fixing this by guessing is slow and frustrating.

The Solution

Resource requests and limits let you tell Kubernetes exactly how much CPU and memory each app needs and the max it can use. This keeps apps running smoothly and fairly on shared machines.

Before vs After
Before
containers:
  - name: app
    image: myapp:latest
After
containers:
  - name: app
    image: myapp:latest
    resources:
      requests:
        memory: "256Mi"
        cpu: "500m"
      limits:
        memory: "512Mi"
        cpu: "1"
What It Enables

This makes your apps stable and your cluster efficient by preventing resource fights and crashes.

Real Life Example

In a busy online store, setting resource requests and limits stops one sale app from slowing down the whole site during big shopping days.

Key Takeaways

Manual resource management causes crashes and slowdowns.

Requests and limits tell Kubernetes how much CPU and memory each app needs.

This keeps apps stable and the system fair and efficient.