BM: Baca dalam Bahasa Melayu
World K3: Counters & Doors
Services: one order number
You will learn: to give a group of pods one fixed address with a Service.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
Shop trays come and go, and so do their IPs. The client needs one address that always works. What would you give it?
Pick one answer.
Watch
kind-dev namespace defaultA Service: One order number, whichever stall cooks it: a fixed address for a group of pods. is one order number for a group of pods. Its CLUSTER-IP stays put while trays come and go.
Try it
A Service finds its trays by label. One shop tray lost its sticker. Give it back.
Drag a label onto a tray, or tap a label, then a tray.
Service shop (order number)
selector:app=shop
Picks 2 trays.
Labels
shop-1
- app=shop
shop picks this tray.
shop-2
- app=shop
shop picks this tray.
shop-3
- No labels yet.
Not picked: needs app=shop.
menu-1
- app=menu
Not picked: needs app=shop.
kubectl get endpointslices -l kubernetes.io/service-name=shopNAME ADDRESSTYPE PORTS ENDPOINTS AGEshop-2jl8t IPv4 80 10.244.1.84,10.244.2.103 12s
Hint
The Service picks every tray withapp=shop.Try it
Your turn. kubectl expose deployment shop --port=80 gives the shop an order number. Then call it by name from the client.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpen- shop·nvxvs
- shop·vdzl6
dev-worker2Open- client
- shop·vd259
Hint
Two commands:kubectl expose …, then kubectl exec client -- wget -qO- -T 5 http://shop.Predict
You delete one shop tray. Does http://shop still answer?
Pick one answer.
Check
This Service file won’t apply. Read kubectl’s words, then fix it.
Fix the manifest, then press Apply.
Plain words: kubectl does not know a field called targetport.
You did it!
You can now give pods one fixed address with a Service.
Go deeper (optional)
port and targetPort can differ: port 80 can lead to a tray’s port 8080. On every stall, kube-proxy sends each order to a random ready tray. The practice sim takes turns instead. This plain kind is called ClusterIP: it works inside the cluster only.
Real rep (optional), on a throwaway kind cluster:
Real mission
kubectl expose deployment shop --port=80kubectl run client --image=busybox:1.37 -- sleep 3600kubectl exec client -- wget -qO- -T 5 http://shop
0 of 3 steps done · Your ticks are saved.
Bahasa Melayu
Dulang kedai datang dan pergi, IP pun sama. Client perlukan satu alamat yang sentiasa berfungsi. Apa yang anda nak beri?
Service (nombor pesanan) ialah satu nombor untuk sekumpulan pod. Alamat CLUSTER-IP kekal walaupun dulang datang dan pergi.
Service cari dulangnya ikut label. Satu dulang kedai hilang pelekat. Pulangkan semula.
app=shop.Giliran anda. kubectl expose deployment shop --port=80 beri kedai satu nombor pesanan. Kemudian panggil ia ikut nama dari client.
kubectl expose …, kemudian kubectl exec client -- wget -qO- -T 5 http://shop.Anda padam satu dulang kedai. Adakah http://shop masih menjawab?
Fail Service ini tak boleh apply. Baca kata-kata kubectl, kemudian baiki.
Maksudnya: kubectl tak kenal medan bernama targetport.
Kini anda boleh beri pod satu alamat tetap dengan Service.
You finished this before. Practice is always welcome!
Official docs: Kubernetes: Service · kubectl expose
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?