Kubernetes basics for backend developers

Cloud, deploys and infrastructure Mid-level Python 3.13+ PostgreSQL 17+ Reviewed By Best Latest Apps

Pick the fix

A service's p99 latency spikes every minute while average CPU looks low. Pods have a tight CPU limit. Likely cause?

Options
Hint 1 of 1

What does a CPU limit do when reached?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A CPU throttling at the limit during bursts

Correct. Short bursts hit the quota and the pod waits.

A CPU limit is a quota per scheduling period. Bursts use up the quota early and the container is paused until the next period, which shows as latency spikes while average CPU stays low.

Why not the others?
  • B Memory OOM kills. Those restart the pod, not slow it.
  • C DNS caching. Unrelated to the pattern.
  • D Too many replicas. Would lower latency.

30-second answer

A Deployment keeps N replicas of your pod running and rolls out new versions gradually. A Service gives those pods one stable address and load-balances across ready ones; an Ingress or gateway exposes HTTP routes outside. ConfigMaps and Secrets inject configuration. Probes tell Kubernetes when to restart a pod or send it traffic. Resource requests decide scheduling, and limits cap usage: hitting the memory limit kills the pod, hitting the CPU limit throttles it.

Practise saying it · 30 s. No recording, just a timer

Kubernetes for devs.

Say your answer out loud, then check which of these points you covered:

  • Deployment
  • Service, Ingress
  • Config, Secrets
  • Probes
  • Requests vs limits

Deep dive

HorizontalPodAutoscaler scales replicas on metrics.

PodDisruptionBudgets keep enough replicas up during node maintenance.

Set requests from measured usage; missing requests cause noisy-neighbour problems.

Rolling updates use maxSurge and maxUnavailable.

Common mistakes

  • No resource requests.
  • Memory limits below real peak usage, causing OOM kills.
  • Liveness probes that check dependencies.

Senior take & follow-ups

Deployment, Service, Ingress, config, probes, requests and limits.

Follow-up questions

Think of your answer first, then open the hint.

  1. What happens at the memory limit?

    Show hint

    The container is OOM-killed.

  2. At the CPU limit?

    Show hint

    It's throttled, which shows up as latency.

Suggest a fix if something here is wrong or out of date.