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
KubeConfig.runExec doesn't work with kubeconfig exec command #3240
Comments
Ah yes, I see the problem. I think in cases where the file for the kubeconfig isn't present, we should just use the current working directory. |
In this case the kubeconfig file is not even in the current directory, it’s located in its default location ( Wouldn’t it be best to just use the data loaded into the KubeConfig object instead? I don’t know Java very well, but from what I understand of the code, it seems that the required information is present in the object. |
I looked at the code and I don't think that the kubeconfig you supplied could have triggered this exception. The code is here: And in order to throw that exception, your I think that there actually is a bug here, but to debug properly I need the correct kubeconfig which you used. |
That's my bad, I copied the kubeconfig example on the three issues I opened at once and since I did multiple tests to try to make each of them work, I kept the command as I don't think the real path is super relevant but it's something like that: Sorry about that and thanks for the quick fix! If you wish me to, I can test the fix tomorrow and let you know. |
Describe the bug
This issue occurs with any kubeconfig file which uses an
exec
command to get user credentials.When instantiating the
ApiClient
class throughClientBuilder.kubeconfig
and a kubeconfig file built withKubeConfig.loadKubeConfig
, the following error occurs:It seems that the
KubeConfig.runExec
method expects the kubeconfig to be provided as a file rather than aKubeConfig
object.The
KubeConfigFileClientExample.java
example can be fixed with the following changes:Client Version
20
Kubernetes Version
1.28.6
Java Version
17
To Reproduce
Generate a kubeconfig file in
$HOME/.kube/config
which uses anexec
command to get user credentials.Expected behavior
Everything works fine
KubeConfig
Server (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: