World map

 

BM: Baca dalam Bahasa Melayu

World K5: Lunch Rush

metrics-server and kubectl top

You will learn: how to see which tray uses the most CPU and memory right now.

Checked with Kubernetes 1.37 on 31 Oct 2026

The problem

Lunch is slow today. Every tray says Running. But one of them eats the stall’s memory. How do you find it?

Pick one answer.

Watch

You are here: cluster kind-dev namespace default
On a fresh kind cluster, kubectl top pods prints: error: Metrics API not available. Terminal output: $ kubectl top pods error: Metrics API not available

kubectl top needs a meter reader. That reader is metrics-server: The meter reader: it checks how much CPU and memory each tray uses right now. kubectl top and the HPA read it.. A fresh kind cluster has none.

error: Metrics API not available means: nobody reads the meters yet.

Try it

This cluster has metrics-server. Type kubectl top pods. Which tray uses the most memory?

You are here: cluster kind-dev namespace default
Stalls: 3. Trays: 4 (4 ready). Waiting for a stall: 0.
dev-control-planeOpenManager

No trays here.

dev-workerOpen
  • report
  • shop·nv7hj
dev-worker2Open
  • shop·bdxbf
  • shop·spmrh
Time: +0s (sped up)

Check

kubectl top pods showed this. Who is hungry?

NAME                   CPU(cores)   MEMORY(bytes)
report                 1m           287Mi
shop-bc64465c6-bdxbf   1m           3Mi
shop-bc64465c6-nv7hj   1m           3Mi

Pick one answer.

Try it

kubectl top nodes shows each stall. report sits on one worker stall. Tap that stall: it uses about 300Mi more than its twin.

Tap the worker stall where report runs.

0 of 1 found

Predict

kubectl top says 287Mi now. You ask again in an hour. What can it show you?

Pick one answer.

Check

metrics-server is built for autoscaling, not for monitoring. Sort each job.

Drag a card into a box. Or tap the card, then tap the box.

      You did it!

      You can now find the hungriest tray with kubectl top.

      Go deeper (optional)

      Real rep (optional), on a throwaway kind cluster only. The insecure flag is for testing, never a real cluster.

      Real mission

      1. kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
      2. kubectl patch deployment metrics-server -n kube-system --type=json -p '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'
      3. kubectl top nodes

      0 of 3 steps done · Your ticks are saved.