MidKubernetes

How do you decide CPU and memory requests and limits for a service, and what breaks if you get them wrong?

What they are really testing: Whether you understand that requests drive scheduling and limits drive enforcement, and that CPU and memory behave completely differently when exceeded.

A real interview question

How do you decide CPU and memory requests and limits for a service, and what breaks if you get them wrong?

What most people say

drag me

I would set limits generously so the app never runs out.

Generous limits with no requests means the scheduler cannot pack nodes properly, so you pay for capacity you never use, and it still does not prevent an OOM kill if the request was low and the node is under pressure.

The follow-ups they ask next

  • What are Guaranteed, Burstable and BestEffort QoS?

    Requests equal to limits gives Guaranteed, requests below limits gives Burstable, neither set gives BestEffort. Under node pressure Kubernetes evicts BestEffort first and Guaranteed last.

  • Latency spikes but no errors and CPU sits below limit on average. What do you suspect?

    CPU throttling. Averages hide short bursts hitting the quota within each period. Check the throttling metric directly rather than usage.

What the interviewer is listening for

  • Separates scheduling from enforcement
  • Knows memory kills and CPU throttles
  • Bases numbers on measured load

What sinks the answer

  • Sets limits without requests
  • Unaware of throttling as a latency cause
  • Guesses numbers with no data

If you genuinely do not know

Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.

Requests [drive scheduling and set your floor], limits [enforce]. Memory over limit [kills the container], CPU over limit [throttles it, showing up as latency with no errors]. I set both [from measured load with headroom], and I am [cautious with tight CPU limits].

Keep going with kubernetes

All 87 devops engineer questions

Knowing the answer is not the same as recalling it under pressure

Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.

Start free