-
Notifications
You must be signed in to change notification settings - Fork 923
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
Improve error message for action on missing namespace #1290
Comments
@techmaharaj: This issue is currently awaiting triage. SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the The 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. |
I think, your suggestion seems reasonable. However, this change would affect all of kubectl commands. Moreover, these messages are here for a long time and although their context is arguable, external scripts relying on this message will fail which we don't want. |
Sure, I've not checked this with other kubectl commands, but this one felt odd. Frankly, I don't quite understand the complete complexity of the changes required to fix this, but I feel we should improve such verbiage to avoid any confusion to the user. |
/retitle Improve error message for action on missing namespace I think we'd need API support so that kubectl can tell the cause of the 404 response (missing namespace? missing pod?) atomically. If kubectl were to make 2 requests, the API state might have changed between the first and second request. Then kubectl could print its existing error message and a hint that you might be looking in a nonexistent namespace. If we had that API support, |
This is intentional see this comment for more details #1118 (comment). In short the server hides the information whether you don't have access to a namespace or it doesn't exist to not make it easy to iterate over cluster namespaces and read its full contents. /close |
@soltysh: 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. |
@soltysh do you think we could improve the user experience here, so that the user at least knows that “invalid namespace” is a possible explanation? |
If we're willing to have kubectl make a second request but only use a 404 from that get to print a hint (ie, not implying authoritatively that the issue is down to a missing namespace), that might help users without presenting a security risk. A user not entitled to check the namespace would get a 403 Forbidden response and kubectl could then print a more neutral message. |
Maybe the error message could read, "No resources in the namespace or the namespace doesn't exist"? |
What happened:
When a
<namespace>
is not present, runningkubectl get pods -n <namespace>
shows the error messages asNo resources found in <namespace> namespace.
It works fine when running
kubectl get ns <namespace>
as it then gives an errorError from server (NotFound): namespaces "<namespace>" not found
What you expected to happen:
Since the
namespace
is not created in the first place, it should show a message thatnamespaces <namespace> not found
rather thanNo resources found in namespace
How to reproduce it (as minimally and precisely as possible):
kubectl get pods -n test
(ensure that the namespace test is not already present)The text was updated successfully, but these errors were encountered: