Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 385
todd_dsm Avatar asked Oct 14 '25 18:10

todd_dsm


1 Answers

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

kubectl config use-context minikube
like image 115
Samuel Bagattin Avatar answered Oct 17 '25 12:10

Samuel Bagattin