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-context
kubectl config view --minify -o jsonpath='{..server}'

Related terms

Taught in

References

Certification courses