World map

 

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

You are here: cluster 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

You are here: cluster kind-dev namespace default
kubectl config get-contexts lists two contexts: kind-dev with a star, and prod-like with the namespace shop. Terminal output: $ kubectl config get-contexts CURRENT NAME CLUSTER AUTHINFO NAMESPACE * kind-dev kind-dev kind-dev prod-like prod-like admin@prod-like shop

kubectl 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.

You are here: cluster kind-dev namespace default
Stalls: 3. Trays: 1 (1 ready). Waiting for a stall: 0.
dev-control-planeOpenManager

No trays here.

dev-workerOpen
  • tray
dev-worker2Open

No trays here.

Time: +0s (sped up)

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.

You are here: cluster kind-dev namespace default
Stalls: 3. Trays: 1 (1 ready). Waiting for a stall: 0.
dev-control-planeOpenManager

No trays here.

dev-workerOpen
  • tray
dev-worker2Open

No trays here.

Time: +0s (sped up)

Check

Good habit, or needs work? Swipe each one.

Swipe right for good, left for needs work. Or use the buttons.

1 / 4

Run current-context before anything risky

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?