BM: Baca dalam Bahasa Melayu
World K3: Counters & Doors
HTTPRoute: signboards to stalls
You will learn: to send each path to the right Service with HTTPRoute rules.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
kind-dev namespace defaultThe menu API lives at /api. But every order lands at the shop counter. The shop has no /api/menu, so it says 404.
Watch
Tap each point on the timeline.
An HTTPRoute: Signboards at the entrance: which path goes to which Service. holds the signboards. Each rule is a path, then a Service. The most specific sign wins.
Try it
routes.yaml adds this sign. Apply it, then ask for /api/menu again.
- matches:
- path:
type: PathPrefix
value: /api
backendRefs:
- name: api
port: 80kind-dev namespace defaultentrance 172.18.0.200/ → shopapi2/2 readyshop3/3 ready
dev-control-planeOpenManagerNo trays here.
dev-workerOpen- api·w7hql
- shop·hl847
- shop·qcgst
dev-worker2Open- api·lrtxv
- shop·pm62t
Check
Mei wrote her own /api sign. It won’t apply. Fix it.
Fix the manifest, then press Apply.
Plain words: a path must start with /.
Predict
Which mistake makes the entrance answer 500? Try the breaks, one at a time.
Break one hop so the user gets: 500 Internal Server Error.
- BrowserGET /api/menu on port 80
- Gateway (entrance)entrance listens on :80
- HTTPRoute (signboard)/api → api:80
- Service (order number)api: port 80 → 8080
- EndpointSlice (ready trays)2 ready of 2
- Pod (tray)api-6d8f7b9c5d-k2x8p listens on :8080
Hint
A sign that points to a Service that doesn’t exist.Check
Two signs: PathPrefix /api and PathPrefix /. Where does each order go?
Drag a card into a box. Or tap the card, then tap the box.
You did it!
You can now send each path to the right Service.
Go deeper (optional)
Rules can also match hostnames and headers. Two backendRefs with weights, like 90 and 10, make a canary. Filters can redirect HTTP to HTTPS. kubectl describe httproute shows ResolvedRefs: a missing Service shows BackendNotFound.
Real rep (optional), on your kind cluster with a Gateway controller:
Real mission
kubectl describe httproute
0 of 4 steps done · Your ticks are saved.
Bahasa Melayu
API menu tinggal di /api. Tapi setiap pesanan sampai ke kaunter kedai. Kedai tiada /api/menu, jadi ia kata 404.
HTTPRoute pegang papan tanda. Setiap peraturan ialah satu laluan, kemudian satu Service. Papan paling khusus menang.
routes.yaml tambah papan tanda ini. Apply, kemudian minta /api/menu sekali lagi.
- matches:
- path:
type: PathPrefix
value: /api
backendRefs:
- name: api
port: 80
Mei tulis papan /api sendiri. Ia tak boleh apply. Baikinya.
Maksudnya: laluan mesti bermula dengan /.
Silap mana yang buat pintu masuk jawab 500? Cuba setiap kerosakan, satu demi satu.
Dua papan: PathPrefix /api dan PathPrefix /. Ke mana setiap pesanan pergi?
Kini anda boleh hantar setiap laluan ke Service yang betul.
You finished this before. Practice is always welcome!
Official docs: Gateway API: HTTPRoute · Gateway API: HTTP routing guide
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?