kubeconfig context
A named pairing in a kubeconfig of one cluster, one user and an optional default namespace; the current context decides where kubectl goes.
A command run in the wrong context changes the wrong cluster.
In more detail
The same command means different things in different contexts, and your shell remembers a context you chose an hour ago. Check the current context before anything destructive, or show it in your prompt. kubectl config view --minify prints only the settings the current context uses.
Examples
kubectl config current-contextkubectl config view --minify -o jsonpath='{..server}'Related terms
- kubeconfig — The file that tells kubectl which clusters exist, which credentials to use, and which pairing of the two is currently selected.
- Kubernetes namespace — A named area inside a cluster that keeps object names apart and groups them for permissions, quotas and policies.
- kubectl — The command-line tool for talking to a Kubernetes cluster's API server: creating, reading, changing and deleting objects.
Taught in
- Two Hours, Twenty Tasks: Exam Strategy — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Bootstrap A Local Cluster And Check Your Context — Kubernetes: Production-Grade Container Orchestration