Kubectl Use-context |top| Instant

A common horror story in DevOps culture involves an engineer intending to delete a pod in a development environment, only to realize too late that they had run kubectl use-context production an hour earlier. The command kubectl delete pod is irreversible; if run in the wrong context, it can cause production outages.

A "context" in Kubernetes is a group of access parameters that includes a , a user , and a namespace . When you switch contexts, all subsequent kubectl commands are directed at that specific environment. Common Commands Switch Context : To change to a specific context by name: kubectl config use-context ``` Use code with caution. Copied to clipboard kubectl use-context

: To see which context you are currently using: kubectl config current-context ``` Use code with caution. Copied to clipboard Why It Is Used A common horror story in DevOps culture involves

Managing multiple contexts is essential when you work across different environments, such as , or when managing clusters from different cloud providers. It prevents you from accidentally running commands (like deleting a pod) in the wrong cluster. When you switch contexts, all subsequent kubectl commands

It lets you instantly switch between clusters, namespaces, or users without editing config files.

Rename contexts for clarity: