World map

 

BM: Baca dalam Bahasa Melayu

World K5: Lunch Rush

Logs and events

You will learn: how to read the cook's notebook (logs) and the manager's notice board (events).

Checked with Kubernetes 1.37 on 31 Oct 2026

The problem

A customer says order 42 came late. The kitchen tray says Running. Where do you look first?

Pick one answer.

Watch

You are here: cluster kind-dev namespace default
kubectl logs kitchen prints three lines: order 41 ready, order 42 oven too cold, order 42 ready. Terminal output: $ kubectl logs kitchen order 41 ready order 42 oven too cold order 42 ready

logs: The cook's notebook: everything a container prints. are the cook’s notebook: everything the container prints. kubectl logs kitchen reads it. There’s the clue: the oven was too cold.

Try it

Busy cooks write long notebooks. Show only the last line with --tail=1.

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

No trays here.

dev-workerOpen
  • kitchen
dev-worker2Open

No trays here.

Time: +0s (sped up)

Watch

You are here: cluster kind-dev namespace default
The oops pod is in CrashLoopBackOff. Its previous run printed: starting the kitchen, then oh no, no gas. Terminal output: $ kubectl get pods NAME READY STATUS RESTARTS AGE oops-6c5fb65c57-ht8mq 0/1 CrashLoopBackOff 3 (13s ago) 46s $ kubectl logs oops-6c5fb65c57-ht8mq --previous starting the kitchen oh no, no gas

CrashLoopBackOff: the tray keeps crashing, so Kubernetes waits longer between restarts. Each restart starts a clean notebook. --previous reads the notebook from the run that crashed.

Predict

You delete the kitchen pod. A new one takes its place. Can you still read the old pod’s logs?

Pick one answer.

Watch

You are here: cluster kind-dev namespace default
Four events for the kitchen pod: Scheduled to dev-worker, image already present, Created, Started. Terminal output: $ kubectl get events --field-selector involvedObject.name=kitchen LAST SEEN TYPE REASON OBJECT MESSAGE 14s Normal Scheduled pod/kitchen Successfully assigned default/kitchen to dev-worker 13s Normal Pulling pod/kitchen Pulling image "busybox:1.37" 12s Normal Pulled pod/kitchen Successfully pulled image "busybox:1.37" in 1.868s (1.868s including waiting). Image size: 2150000 bytes. 12s Normal Created pod/kitchen Created container: cook 12s Normal Started pod/kitchen Started container cook

event: A note on the manager's notice board: scheduled, pulled, started, or a warning. Kept for a short time. are the manager’s notice board: placed, pulled, started, and warnings. Kubernetes writes them, not your app. They fade after a short time.

Check

Notebook or notice board? Sort each line.

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

      You did it!

      You can now read a tray’s logs and the zone’s events.

      Go deeper (optional)

      kubectl logs -f kitchen follows new lines. -c cook picks one container. --since=10m shows only recent lines. kubectl events --for pod/kitchen shows one pod’s events. By default the API server keeps events for one hour. To keep logs longer, send them to a log store (next lesson).