New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected behavior when using multiple contexts in kubeconfig #936
Comments
I believe this is #737 is related. The author solved his own problem. However, I am guess that's exactly the same behavior the workshop participants experience. |
Validation of the configuration is done here: The is already a validaor that checks that the context
To fix this issue, a validator that checks that the configuration has |
Your suggested error content looks good to me. Is there a situation where localhost is desired? |
The current behavior is to ignore this and try to connect to localhost:8080. [This is quite confusing, as reported in this issue][1]. This commit improves the UX by telling the users they need to explicitly choose a context in the that multiple context exist: ``` $ kubectl get pods error: Multiple contexts found. However, no current-context is set in the configuration ``` [1]: kubernetes/kubectl#936
/priority backlog |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-contributor-experience at kubernetes/community. |
Rotten issues close after 30d of inactivity. Send feedback to sig-contributor-experience at kubernetes/community. |
@fejta-bot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
When using a config with multiple contexts, one might see a surprising message if there is no context set.
Let me demostrate:
Here, I have a context set. So
kubectl get pods
or any other command works fine.If there is no current-context, kubectl says it can't connect to localhost (that's reasonable if you know k8s, more on that below).
What would you like to be added:
The above message is baffling if you encounter this for the first time. A better message would be something like this:
Why is this needed:
I give Kubernetes workshops, where students use multiple clusters. As we go through setting
~/.kube/confing
for usage with multiple clusters, some students will rush to try stuff, and forget to set a context. This results in frustration and funny facial expressions staring at the screen. We explain thatkubectl
, uses localhost per default - and that older versions of kubernetes where not secured on localhost. A much better UI will be simply telling the user he didn't set up a context.I'm willing to send a PR for improving this UI. This should not be hard to fix (I have already submitted code to k8s/k8s).
/sig usability
The text was updated successfully, but these errors were encountered: