Skip to content
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

Kubernetes config not updated when token refreshed #399

Closed
inikolaev opened this issue Jan 26, 2020 · 6 comments
Closed

Kubernetes config not updated when token refreshed #399

inikolaev opened this issue Jan 26, 2020 · 6 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@inikolaev
Copy link
Contributor

inikolaev commented Jan 26, 2020

I'm using OIDC authentication and running in the the following issue:

OpenIdConnectError: invalid_request (Refresh token is invalid or has already been claimed by another client.)
    at Client.requestErrorHandler (/Users/inikolaev/Projects/kube/node_modules/openid-client/lib/helpers/error_handler.js:16:11)
    at processTicksAndRejections (internal/process/task_queues.js:85:5) {
  error: 'invalid_request',
  error_description: 'Refresh token is invalid or has already been claimed by another client.'
}

After debugging it looks like token is being refreshed correctly the first time, but Kubernetes configuration is not being automatically updated and next time I start application I load old configuration and try to refresh my token using invalid refresh token.

I'm loading configuration from ~/.kube/config and I was expecting it to be updated automatically. I'm not sure is this is how it's supposed to work and if so do you have any pointers on how to update that configuration properly?

@inikolaev inikolaev changed the title Kubernetes config con updated when token refreshed Kubernetes config not updated when token refreshed Jan 26, 2020
@brendandburns
Copy link
Contributor

Unfortunately, the Javascript client library doesn't currently support automatically rewriting the config when it refreshes a token.

There is a utility here:
https://github.com/kubernetes-client/javascript/blob/master/src/config.ts#L352

to call exportConfig() to write the config into a string (which could then be written into a file) so it's possible.

To do it right requires a large-ish refactor of the authenticator interface to include refresh()

@brendandburns
Copy link
Contributor

I'll look into crafting a PR (or probably multiple PRs) to handle this.

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 26, 2020
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 26, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants