Reputation: 431
How can I disconnect from a kubernetes cluster from gitbash, I connected once and I can't "disconnect" or make the cluster name go away.
Upvotes: 13
Views: 11384
Reputation: 2087
It's not connected, it's on your kubectl configs context, you can unset it or use (switch to) another context.
kubectl config get-contexts
kubectl config use-context <context-name>
You may have taken context name from the last command,
e.g. if you've enabled Kubernetes on your docker-desktop, you can use its context with this command:
kubectl config use-context docker-desktop
kubectl config unset current-context
If you unset your current context, you will not have any active context anymore and if you run commands like kubectl get pods
you will get this error:
The connection to the server localhost:8080 was refused - did you specify the right host or port?
Upvotes: 6
Reputation: 431
Thanks a lot. really what I needed was to run the command:
kubectl config unset current-context
Upvotes: 20