Is this a BUG REPORT or FEATURE REQUEST? (choose one):
Feature. Although if it's not implemented it could lead to other bug reports
Minikube version (use minikube version):
0.11.0
What happened:
When minikube start is run it switches your kubectl context to automatically use the minikube context. After minikube is stopped any other kubectl commands hang because they cannot connect to the minikube apiserver
What you expected to happen:
kubectl context should be switched back to the previous context or I should be prompted to choose a context I would like to use after the VM is shut down.
How to reproduce it (as minimally and precisely as possible):
create a context in ~/.kube/config
run minikube start
run minikube stop
Try to run kubectl commands
Another option is to not switch the context on start at all (possibly controlled by a command-line option).
We run minikube in tests, but for the purposes of the test, messing about with the users current context isn't really needed, as all kubectl commands in the test can just use the --context flag to select the correct context for the command.
@mortenlj makes sense, I think I prefer the approach of adding a flag to control whether or not minikube sets the current context.
I'd prefer to keep it current bahaviour but add option to disable it. Having to add --context flag to every kubectl command when working with minikube is not much fun...
Yeah, I agree we should probably keep the default.
Maybe an option to dump minikube to a new kubeconfig file. That way a new context won't be added to their existing kubeconfig and the user can export KUBECONFIG to avoid always setting --context or --kubeconfig
Closing, we have added a --keep-context flag to minikube start and added support for the KUBECONFIG env var. Please feel free to reopen if this is not solve your use case.
Most helpful comment
Closing, we have added a --keep-context flag to minikube start and added support for the KUBECONFIG env var. Please feel free to reopen if this is not solve your use case.