ahmetb / kubectx

Faster way to switch between clusters and namespaces in kubectl
https://kubectx.dev
Apache License 2.0
17.72k stars 1.26k forks source link

doc: how to add new context? #42

Closed glensc closed 6 years ago

glensc commented 6 years ago

so i have minikube in output, how do i add new "context"?

please add such section to readme.

ahmetb commented 6 years ago

I don’t understand this question fully.

Your contexts come from kubectl. See “kubectl config” commands.

glensc commented 6 years ago

yes, if that is the information, include it into readme. improves learning curve for newcomers.

HalisCz commented 5 years ago

I have a bunch of kubeconfig files (one for each cluster) spread among my folders.

I found out this promising tool, and I would like to import those kubeconfig files to kubectx, but I do not know how, and I am not able to find any howto on this. Only thing that I found is this issue.

Would you mind to explain this "howto" to me @ahmetb ?

ahmetb commented 5 years ago

@HalisCz https://medium.com/@ahmetb/mastering-kubeconfig-4e447aa32c75

HalisCz commented 5 years ago

@ahmetb Thank you, that is exactly what I was asking for.

JeremyMordkoff commented 8 months ago

I know this item is closed, but I don't think it's been answered. kubectl does not have a command line option to copy a context. Example...I have a context that let's me focus on namespace foo in cluster x. I deploy something new to namespace bar in cluster x, so now I want to create a new context so I can focus on the new deployment. I have to open the kubeconfig file with an editor and add the new context. I'd really like to be able to do

kubectx copy foo bar ## new command option to copy a context kubectx bar kubectl config set-context --current --namespace=bar

or even better

kubectx copy foo bar --current --namespace=bar ## make it current and reset the namespace :