A Kubernetes context is a kubeconfig entry that combines a cluster, user credentials, and optionally a namespace for kubectl operations. It determines which cluster and identity receive your commands, so verify the active context before changing resources. section 3.2 section 9.7
Manage contexts with kubectl:
- Create or update one with kubectl config set-context, supplying a name, user, cluster, and optionally namespace. section 3.2
- Inspect available contexts with kubectl config get-contexts; the asterisk marks the current context. section 3.2
- Switch the active target with kubectl config use-context NAME, then verify the resulting permissions and cluster. section 3.2 section 9.7
Switching to a restricted user
After adding Carol's credentials, create a context with kubectl config set-context carol --user=carol --cluster=kind-kind. Run kubectl config use-context carol. Carol can list the nginx pod, but deleting it returns Forbidden because the configured identity lacks that permission. section 3.2
