BM: Baca dalam Bahasa Melayu
World K1: The Food Court
You are here: contexts
You will learn: how to see, and change, which cluster kubectl talks to.
Checked with Kubernetes 1.37 on 31 Oct 2026
The problem
prod-like namespace shop Looks like production. Be careful!Ben wanted to delete a test tray. But his terminal pointed at the live shop. Lunch orders stopped. How could he have known?
Watch
kind-dev namespace defaultkubectl keeps a list of food courts in one file: your kubeconfig: The file that lists your clusters and how to reach them (~/.kube/config).. It lives at ~/.kube/config. Each row is one place you can talk to.
Try it
Each row is a context: The "you are here" sign: the cluster and namespace you are using now.: a cluster, a user and a namespace. The star marks where commands go. Type kubectl config current-context.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpen- tray
dev-worker2OpenNo trays here.
Hint
The pink bar on top shows the same answer.Predict
You type kubectl delete pod tray now. Which cluster loses a tray?
Pick one answer.
Try it
Peek at prod-like, then come back. Watch the pink bar change each time.
kind-dev namespace defaultdev-control-planeOpenManagerNo trays here.
dev-workerOpen- tray
dev-worker2OpenNo trays here.
Hint
kubectl config use-context prod-like, then kubectl get pods, then kubectl config use-context kind-dev.Check
Good habit, or needs work? Swipe each one.
Swipe right for good, left for needs work. Or use the buttons.
Run current-context before anything risky
You did it!
You can now check where kubectl points before you act.
Go deeper (optional)
Run one command somewhere else, without switching: kubectl --context prod-like get pods. A shell prompt that shows your context helps too.
Real rep (optional): on your laptop, kubectl config get-contexts lists every cluster you can reach. Is there one you forgot about?
Bahasa Melayu
Ben nak padam dulang ujian. Tapi terminalnya menghala ke kedai yang sedang live. Pesanan makan tengah hari terhenti. Macam mana dia boleh tahu?
kubectl simpan senarai medan selera dalam satu fail: kubeconfig anda. Ia tinggal di ~/.kube/config. Setiap baris ialah satu tempat yang anda boleh hubungi.
Setiap baris ialah satu context (papan “anda di sini”): kluster, pengguna dan namespace. Bintang tanda ke mana arahan pergi. Taip kubectl config current-context.
Anda taip kubectl delete pod tray sekarang. Kluster mana yang hilang dulang?
Intai prod-like, kemudian balik. Perhatikan bar merah jambu berubah setiap kali.
kubectl config use-context prod-like, kemudian kubectl get pods, kemudian kubectl config use-context kind-dev.Tabiat baik, atau perlu diperbaiki? Leret setiap satu.
Kini anda boleh semak ke mana kubectl menghala sebelum bertindak.
You finished this before. Practice is always welcome!
Official docs: Organizing cluster access using kubeconfig files · Configure access to multiple clusters · kubectl config
You've learned for 25 minutes. A short break helps your brain.
Sprint done! Great focus. Stretch for a minute?