World map

 

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

You are here: cluster kind-dev namespace default
curl asks the entrance for /api/menu. The shop's nginx answers 404 Not Found. Terminal output: $ curl -s http://172.18.0.200/api/menu <html> <head><title>404 Not Found</title></head> <body> <center><h1>404 Not Found</h1></center> <hr><center>nginx/1.29.8</center> </body> </html>

The 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: 80
You are here: cluster kind-dev namespace default
Stalls: 3. Trays: 5 (5 ready). Waiting for a stall: 0.
Entrance entrance 172.18.0.200/ → shop
  • api2/2 ready
  • shop3/3 ready
dev-control-planeOpenManager

No trays here.

dev-workerOpen
  • api·w7hql
  • shop·hl847
  • shop·qcgst
dev-worker2Open
  • api·lrtxv
  • shop·pm62t
Time: +0s (sped up)

Check

Mei wrote her own /api sign. It won’t apply. Fix it.

Fix the manifest, then press Apply.

route.yaml16 lines

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.

  1. BrowserGET /api/menu on port 80
  2. Gateway (entrance)entrance listens on :80
  3. HTTPRoute (signboard)/api → api:80
  4. Service (order number)api: port 80 → 8080
  5. EndpointSlice (ready trays)2 ready of 2
  6. Pod (tray)api-6d8f7b9c5d-k2x8p listens on :8080
Break something

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

      1. kubectl describe httproute

      0 of 4 steps done · Your ticks are saved.