-
Notifications
You must be signed in to change notification settings - Fork 200
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
Fails to connect to existing server #354
Comments
Same thing is happening to me. Especially when using https://k8slens.dev/, but it will also cause problems on the CLI. Whenever it prompts you to login and open the browser, if you close it then, the socket (8000) will stay open forever. If you use the CLI, dont cancel the process manually. The second time, it will use the socket 18000. You can see that the socket is still open with
Finally, you will get the error the third time.
You can workaround the problem by killing these hanging processes before calling I believe some sort of timeout that would close the socket and the kubelogin process if it takes too long would solve/mitigate the issue.
|
Thank you for your reports. I'm considering adding a timeout of authentication. It seems the below lines may block. |
int128/oauth2cli#51 may fix this issue. I will release the new version of kubelogin later. |
I just released https://github.com/int128/kubelogin/releases/tag/v1.20.1 and please try using it. |
I just tried it and the old processes don't seem to be closed.
|
This issue still persist. |
I added the authentication timeout (default 180 sec) in https://github.com/int128/kubelogin/releases/tag/v1.21.0. It may fix this issue but still #389 is needed for a fundamental solution. |
@int128 it seems to fix it on my side, or at least remediate to the issue with a weird side effect. With the CLI, I get a transport error when I close a tab, then I get the
With Lens, once the The good thing is that the process always reuses the same port when it reopens a tab, the bad news is that it stays in that loop instead of exiting completely and freeing the port. I would expect lens or the CLI to just return an authentication error after the timeout EDIT: Actually, it retries exactly 5 times... |
Thank you for your detailed report!
I suspect a connection between kubelogin and the browser remains after login. users:
- name: oidc
user:
exec:
apiVersion: client.authentication.k8s.io/v1beta1
command: kubectl
args:
- oidc-login
- get-token
- -v1 (please don't forget to mask your credentials)
Yes, this is an side effect of the timeout. I'm investigating #389. |
I have the following logs. But at this point, I think there is a retry somewhere in the Kubernetes client and this has nothing to do with the plugin. Sadly, I don't see any options to disable them with
|
Let me clarify. Did you see the success page after login like below? According to the log, the browser accessed the following URLs:
the browser finally should receive a code from your identity provider via a redirect like |
@int128 No, I am intentionally letting the window open 3 minutes (or the timeout duration value) so the timeout condition is triggered. Then, another tab opens. This happens exactly 5 times. Sorry for that! I actually never mentioned that I was not logging in! |
Hello Guys I'm having an issue with the kubectl since last week - we are using OIDC to connect with the K8s server but since last week kubectl is not able to connect with the server
Any help would be greatly appreciated. Environment CC: @int128 |
Also experiencing this, could use a work around. Tried adding --authentication-timeout-sec 30 but it didn't help:
Everything was working, now seeing this seemingly out of the blue. There something I can do to get this working again? For those who come along after this... I got back to working by simply rebooting the system where kubelogin is being run. |
Hello, whats the status of this issue. I am facing the same problem (login loop and program exit). |
Not at a computer at the moment but if I am remembering correctly a login was interrupted resulting in a hung session which was using the port. Ended up rebooting the system and everything started working again and just made sure not to interrupt the login process. I think it's an issue that is reproducible if you close the browser without logging in.
I eventually switched to pinniped which has an option to display a url the client can copy I to a browser. Maybe we need this "display a url" instead of opening Brower for kubelogin .... (or maybe it already has the option and I just haven't found it yet.)
|
Describe the bug
In some circumstances, kubelogin will not talk to an existing kubelogin server, and then fails because it cannot start a new server on the same port.
To Reproduce
I am not entirely sure how to reproduce this. What I have seen is that it works one day and then fails the next. Whether it is because the computer went to sleep in between, or the refresh token expired, or something else, I do not know. I am happy to do further debugging but need guidance.
Kubeconfig excerpt
Expected behavior
I expect kubelogin to use the existing server if it is running and shut it down if it is somehow unusable. Instead, it keeps the server running but does not use it.
Environment
The text was updated successfully, but these errors were encountered: