World map

 

BM: Baca dalam Bahasa Melayu

World K3: Counters & Doors

Debug with port-forward

You will learn: to open a private tunnel from your laptop to one pod.

Checked with Kubernetes 1.37 on 31 Oct 2026

The problem

The shop page looks odd. You want to see it in your own browser. But you don’t want to open a door to the whole street. What do you do?

Pick one answer.

Watch

You are here: cluster kind-dev namespace default
port-forward says Forwarding from 127.0.0.1:8080 to 80. curl localhost:8080 gets the shop page. Terminal output: $ kubectl port-forward svc/shop 8080:80 Forwarding from 127.0.0.1:8080 -> 80 Forwarding from [::1]:8080 -> 80 $ curl -s localhost:8080 <h1>Kedai Kancil</h1>

A port-forward: A private staff hatch from your laptop to one pod, while the command runs. is a private staff hatch. localhost:8080 on your laptop leads to port 80 of one shop tray.

Try it

Build the command: laptop port 8080 to the shop’s port 80.

Tap the pieces in the right order.

…

Try it

Now open the hatch, then visit it with curl.

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

No trays here.

dev-workerOpen
  • shop·4q525
  • shop·q9bq4
dev-worker2Open
  • shop·gdtqw
Time: +0s (sped up)

Predict

You press Ctrl+C in the port-forward terminal. Then you open localhost:8080 again. What happens?

Pick one answer.

Check

Hatch or real door? Sort each job.

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

      You did it!

      You can now open a private hatch to any pod for debugging.

      Go deeper (optional)

      svc/shop picks one tray when the hatch opens and sticks to it. If that tray goes away, the hatch breaks: run it again. --address 0.0.0.0 lets anyone on your Wi-Fi in. Use it only on purpose.

      Real rep (optional), on a throwaway kind cluster with the shop Service:

      Real mission

      1. kubectl port-forward svc/shop 8080:80

      0 of 3 steps done · Your ticks are saved.