简体   繁体   中英

set default kubernetes cluster

This is kind of a silly one but, given a number of clusters...

How would a user specify one cluster to be set as the default?

CURRENT  NAME
*        minikube   
         stage     
         prod      

Every time I open a new Terminal (macOS), it defaults to prod . I know I'm just one misstep away from not paying attention and destroying something valuable.

  • If I set minikube as the current cluster, then open new tabs in the same Terminal window, minikube remains the default.
  • If I were to Quit the Terminal altogether and reopen it, it would default back to prod .

Anecdotally, I've used ktx forever and never had this issue. Recently tried kubectx and this is the first time I've noticed the behavior. I don't see anything in their docs about setting a default cluster so seems unlikely.

If anyone knows how to set a default cluster, please advise.

If you use kubectl , the command kubectl config use-context might help. In your case:

kubectl config use-context minikube

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM