53

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?

arshbot
  • 12,535
  • 14
  • 48
  • 71

2 Answers2

115

Renaming contexts is easy!

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

Confirm the change by

$ kubectl config get-contexts 
arshbot
  • 12,535
  • 14
  • 48
  • 71
16

If you are using kubectx try

kubectx new-context-name=old-context-name
Most Wanted
  • 6,254
  • 5
  • 53
  • 70