BM: Baca dalam Bahasa Melayu
World K6: Guards · Boss challenge
Lock the kitchen
You will learn: to pass the restricted Pod Security level and give a CI bot only the rights it needs.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
Tap each point on the timeline.
Kedai Kancil opens tomorrow. Its zone has no guard. The CI bot holds a master key. Lock the kitchen, room by room.
Try it
Room 1: switch on restricted for kedai. Dry run first, to see what would break.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpen- shop·hj28m
dev-worker2Open- shop·rklp9
Hint
Add--dry-run=server and the cluster changes nothing.Try it
The warnings named four broken rules. Which lines fix them?
Drag a card into a box. Or tap the card, then tap the box.
Try it
Room 2: Mei applied the shop after you locked the zone. Zero trays run. Two fixes wait in your folder. One still breaks a rule. Get two trays running.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpenNo trays here.
dev-worker2OpenNo trays here.
Hint
A Deployment gets in with a warning. Its trays are refused later.Try it
Room 3: the CI bot holds cluster-admin in kedai. Unplug that wire. Give it only the deployer card.
Connect wires until every answer matches. Give only what is needed.
Who (plugs)
- ci-bot (ServiceAccount · ci)
- mei (user)
Roles (sockets)
- Role deployer · kedai
get, list, patch · deployments
- ClusterRole cluster-admin · whole cluster
* · *
Wires (bindings)
- ci-bot to cluster-adminRoleBinding · in namespace kedai
Show ci-bot-admin as YAML
apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: name: ci-bot-admin namespace: kedai subjects: - kind: ServiceAccount name: ci-bot namespace: ci roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: cluster-admin
Can they? (kubectl auth can-i)
kubectl auth can-i patch deployments -n kedai --as=system:serviceaccount:ci:ci-botyesshould be yes matchesAllowed by ci-bot-admin → cluster-admin.kubectl auth can-i get secrets -n kedai --as=system:serviceaccount:ci:ci-botyesshould be no not yetAllowed by ci-bot-admin → cluster-admin.kubectl auth can-i delete deployments -n kedai --as=system:serviceaccount:ci:ci-botyesshould be no not yetAllowed by ci-bot-admin → cluster-admin.
Ask your own question
kubectl auth can-i get pods -n kedai --as=system:serviceaccount:ci:ci-botyes
Hint
Unplug first. Then wire ci-bot to deployer, in kedai.Try it
Room 4: now in the terminal. Remove the master key. Apply the job card and pin it. Then ask as the bot.
kind-dev namespace defaultHint
Three commands, then one question. The bot lives in the ci zone.Check
Last check. The bot’s job now also reads pod logs to report errors. What do you add?
Pick one answer.
You did it!
You can now lock a zone and keep a bot’s keys small.
Go deeper (optional)
Real rep (optional): do all four rooms on a throwaway kind cluster. Make the kedai and ci zones first. Dry run every label. Read the pink “you are here” bar before each delete.
Real mission
kubectl create namespace kedai && kubectl create namespace cikubectl label ns kedai pod-security.kubernetes.io/enforce=restrictedkubectl create serviceaccount ci-bot -n cikubectl create role deployer -n kedai --verb=get,list,patch --resource=deployments && kubectl create rolebinding ci-bot-deployer -n kedai --role=deployer --serviceaccount=ci:ci-botkubectl auth can-i get secrets -n kedai --as=system:serviceaccount:ci:ci-bot
0 of 5 steps done · Your ticks are saved.
Bahasa Melayu
Kedai Kancil buka esok. Zonnya tiada pengawal. Bot CI pegang kunci induk. Kunci dapur, bilik demi bilik.
Bilik 1: hidupkan restricted untuk kedai. Dry run dulu, untuk lihat apa yang akan rosak.
--dry-run=server dan kluster tak ubah apa-apa.Amaran tadi sebut empat peraturan yang dilanggar. Baris mana yang membaikinya?
Bilik 2: Mei apply kedai selepas anda kunci zon. Tiada dulang berjalan. Dua pembaikan menunggu dalam folder. Satu masih langgar peraturan. Jalankan dua dulang.
Bilik 3: bot CI pegang cluster-admin dalam kedai. Cabut wayar itu. Beri ia kad deployer sahaja.
Bilik 4: sekarang di terminal. Buang kunci induk. Apply kad tugas dan pin. Kemudian tanya sebagai bot.
Semakan akhir. Kerja bot kini perlu baca log pod untuk lapor ralat. Apa anda tambah?
Kini anda boleh kunci zon dan kecilkan kunci bot.
You finished this before. Practice is always welcome!
Official docs: Pod Security Standards · Using RBAC authorization · RBAC good practices
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?