-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support for the expiration of the token #2112
Comments
This seems somehow related to #2111 |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
This is quite an annoying issue. To work this around, I have created a utility function that makes a private fun tryK8sTokenRefresh(contexts: List<String?>) = runBlocking(Dispatchers.IO) {
val kubeConfig = KubeConfigUtils.parseConfig(File(Config.getKubeconfigFilename()))
kubeConfig
.contexts
.filter { nc -> contexts.isEmpty() || contexts.contains(nc.name) }
.toList().pmap {
// Make a request on each cluster to refresh the access tokens
val versionCmd = "kubectl version --context=${it.name}".runCommand()
if (versionCmd.first != 0) {
verbose(
"An error occurred connecting to $it. Check your k8s configuration.\n${versionCmd.second}",
err = true
)
true
} else {
verbose("Refreshed token for ${it.name} -> $versionCmd")
false
}
}
} |
Any update on this issue? |
Is this still happening? I recall we added automatic token refresh mechanism for a few scenarios. If it is, is anyone with a GCP cluster willing to contribute a fix? |
The specific circumstances as described -- USING GCP/GKE -- is still a "problem", but AFAICT from digging into the code and some previuosly closed issues, this problem is not due to a bug in this repo... (NOTE: I am not an expert on oath, k8, this repo, or GCP/GKE -- what follows is just my layman understanding based on issue spelunking) The Subsequent This As noted in pull #1348 this entire auth config syntax that
NOTE however that while the the GCP/GKE specific
...if however you put that same "gcloud | jq" logic into an (executable) shell script, the following configuration works just fine...
|
❤️ Thanks for the detailed explanation. So I understand that a temporary workaround would be to use something similar to your |
Assuming everything i said is correct, and I'm not missunderstanding something, then short answer: "Yes" ... using the Longer Answer: If i were a maintainer for
|
The current implementation does not support BoundServiceAccountTokenVolume which is enabled as the default in EKS 1.21+. See the following links: https://docs.aws.amazon.com/eks/latest/userguide/kubernetes-versions.html#kubernetes-1.21 |
When is this feature going to be supported kubernetes/enhancements#542 in fabri8io clients. |
Removing the never stale. There could still be follow-up on 1, 2 in #2112 (comment) but the basic support for expiration is ensured with #4802. That is we'll always fully refresh on an failure. The only true expiration awareness was added for OIDC refreshes - exec and other tokens from the config will be refreshed every minute. |
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions! |
Right now the client begins to fail once the expiration time comes. For example if the client is created in the environment with the following
.kube/config
:after the time 2020-04-04T21:52:48Z comes the client throws exception:
And the application requires the token refresh (by running
kubectl
command) and creation of a new a client instance (which reads the new token).The text was updated successfully, but these errors were encountered: