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

kubelogin can't use auth token after it gets refreshed by kubefwd #275

Open
glebteterin opened this issue May 8, 2024 · 2 comments
Open

Comments

@glebteterin
Copy link

Hi, I love kubefwd but when it runs long enough to refresh the auth token with kubelogin, the new token is created under root. So the next time I'm using kubectl it complains about the following:

Error: unable to read from token cache: /Users/glebteterin/.kube/cache/kubelogin/AzurePublicCloud-6dae42f8-4368-4678-94ff-3960e28e3630-80faf920-1908-4b52-b5ef-a8e7bedfc67a-07022bea-b53d-4f90-88f7-95421ccfafc9.json, err: failed to open file (/Users/glebteterin/.kube/cache/kubelogin/AzurePublicCloud-6dae42f8-4368-4678-94ff-3960e28e3630-80faf920-1908-4b52-b5ef-a8e7bedfc67a-07022bea-b53d-4f90-88f7-95421ccfafc9.json) while loading token: open /Users/glebteterin/.kube/cache/kubelogin/AzurePublicCloud-6dae42f8-4368-4678-94ff-3960e28e3630-80faf920-1908-4b52-b5ef-a8e7bedfc67a-07022bea-b53d-4f90-88f7-95421ccfafc9.json: permission denied

So I have to delete the token manually and login into the cluster again.
I wonder if there's a solution?

@glebteterin
Copy link
Author

I just had a light bulb moment. I'll clone the cluster config in .kube/config to use with kubefwd exclusively. I will update the status of the issue once I have verified that the solution works

@glebteterin
Copy link
Author

Unfortunately, cloning the cluster under different name in .kube/config didn't help. kubelogin stores the auth token in a file named .kube/cache/kubelogin/[environment]-[serverid]-[clientid]-[tenantid].json and those variables of course the same between the original cluster and its copy

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

1 participant