Kubectl How to Rename a Context

I have many contexts, one for staging, one for production, and many for dev clusters. Copy and pasting the default cluster names is tedious and hard, especially over time. How can I rename them to make context switching easier?

2 Answers

Renaming contexts is easy!

$ kubectl config rename-context old-name new-name

Confirm the change by

$ kubectl config get-contexts 

If you are using kubectx try

kubectx new-context-name=old-context-name

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest