World map

 

BM: Baca dalam Bahasa Melayu

World K3: Counters & Doors

NodePort, LoadBalancer and headless

You will learn: the four kinds of Service, and when to use each.

Checked with Kubernetes 1.37 on 31 Oct 2026

The problem

You are here: cluster kind-dev namespace default
Two Services: kubernetes and shop. Both are ClusterIP, with no EXTERNAL-IP. Terminal output: $ kubectl get services NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 5m21s shop ClusterIP 10.96.245.76 <none> 80/TCP 21s

The shop’s order number is a ClusterIP. It only works inside the food court. Customers on the street can’t use it. How do they get in?

Watch

Tap each point on the timeline.

A Service has a type. Each type opens one more door than the last. Tap all four.

Try it

A NodePort: A side window on every stall: the same port (30000–32767) open on every node. opens the same port on every stall. Apply nodeport.yaml. Then call one stall’s address from your laptop.

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·dxxm9
  • shop·v9wlp
dev-worker2Open
  • shop·sb74g
Time: +0s (sped up)

Watch

You are here: cluster kind-dev namespace default
A LoadBalancer Service called shop-lb. Its EXTERNAL-IP says pending. Terminal output: $ kubectl expose deployment shop --type=LoadBalancer --port=80 --name=shop-lb service/shop-lb exposed $ kubectl get service shop-lb NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE shop-lb LoadBalancer 10.96.245.214 <pending> 80:30080/TCP 0s

A LoadBalancer: A street sign from the cloud: one outside address for a Service. asks the cloud for a street address. A plain kind cluster has no cloud, so it waits: <pending>.

Check

One letter is off. Read kubectl’s answer, then fix the file.

Fix the manifest, then press Apply.

lb.yaml11 lines

Plain words: Kubernetes knows four types, and Loadbalancer is not one of them.

Predict

A database runs as a StatefulSet. Each tray must be called by its own name. Which Service fits?

Pick one answer.

Check

Which type fits each job?

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

        You did it!

        You can now pick ClusterIP, NodePort, LoadBalancer or headless.

        Go deeper (optional)

        On kind, LoadBalancer addresses come from the extra tool cloud-provider-kind. NodePort calls from your laptop work on Linux. On Mac and Windows, kind’s nodes hide inside Docker’s small VM. There is a fifth type, ExternalName: an alias for an outside DNS name.

        Real rep (optional), on a throwaway kind cluster:

        Real mission

        1. kubectl expose deployment shop --type=NodePort --port=80 --name=shop-np
        2. kubectl get service shop-np
        3. kubectl expose deployment shop --type=LoadBalancer --port=80 --name=shop-lb

        0 of 3 steps done · Your ticks are saved.