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

Token file reload #1255

Closed
geotransformer opened this issue May 17, 2023 · 3 comments
Closed

Token file reload #1255

geotransformer opened this issue May 17, 2023 · 3 comments
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@geotransformer
Copy link

geotransformer commented May 17, 2023

Hi team,
We are using Python, java, Go Kubernetes client in our microservices. Recently we have some token expiration issue for some deployment running for more than 1 years.

Calico issue: projectcalico/calico#5910
Java-client issue: fabric8io/kubernetes-client#4264

This is because K8s had some change for service account token renew
Since k8s 1.21, service account tokens have an lifespan of one hour (short-lived & rotation). The token expiration is 365 days actually.

I am wondering for GO client code in the below. Is there any token reloading?

func InClusterConfig() (*Config, error) {

@liggitt liggitt added the triage/needs-information Indicates an issue needs more information in order to work on it. label May 17, 2023
@liggitt
Copy link
Member

liggitt commented May 17, 2023

I am wondering for GO client code in the below. Is there any token reloading?

Yes, setting BearerTokenFile in that method initiates a background process that rereads the token file once a minute.

@liggitt
Copy link
Member

liggitt commented May 17, 2023

the refresh is set up in

rt, err = NewBearerAuthWithRefreshRoundTripper(config.BearerToken, config.BearerTokenFile, rt)
, for reference

@liggitt liggitt added kind/support Categorizes issue or PR as a support question. and removed triage/needs-information Indicates an issue needs more information in order to work on it. labels May 17, 2023
@liggitt liggitt closed this as completed May 17, 2023
@liggitt
Copy link
Member

liggitt commented May 17, 2023

k8s.io/client-go versions v0.15.0+ reload tokens automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

2 participants