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

handling of expired kubeconfig #2995

Open
kaedwen opened this issue Oct 25, 2024 · 2 comments
Open

handling of expired kubeconfig #2995

kaedwen opened this issue Oct 25, 2024 · 2 comments

Comments

@kaedwen
Copy link

kaedwen commented Oct 25, 2024

Hi,

we do have many operators, one of it is using the cluster struct for having a connection to an additional remote cluster. The rest.Config we do load out of a mounted secret during startup. Now I wonder if there is a mechanism to renew the config in use once the secret mount path changes. Sure we can watch that mountpoint (we do that in many other places), but is there a way to change the config of a running client?

I also do wonder how the InClusterConfig is renewed. The coding here just reads the serviceaccount token and never does a reload. But the tokens do have an expiry, so how this is considered to work? Sure the default expiry is 1 year, but it could not be the assumption that the controller will anyway restart at some time.

Regards

@ppodevlabs
Copy link

we upgraded our clusters to 1.30.3 and we are facing the issue that some controllers stop working after 1h due to the bound token being refreshed. Any idea on how to solve this?

@sbueringer
Copy link
Member

sbueringer commented Nov 10, 2024

The coding here just reads the serviceaccount token and never does a reload.

Can you point to where the SA token is only read once?

InClusterConfig reads the token from tokenFile, but it also sets the BearerTokenFile field:
https://github.com/kubernetes/client-go/blob/master/rest/config.go#L544-L545

	// Path to a file containing a BearerToken.
	// If set, the contents are periodically read.
	// The last successfully read value takes precedence over BearerToken.
	BearerTokenFile string

I'm not sure but I think this TokenSource is used eventually: https://github.com/kubernetes/client-go/blob/master/transport/token_source.go#L75-L79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants