int128 / kubelogin

kubectl plugin for Kubernetes OpenID Connect authentication (kubectl oidc-login)
Apache License 2.0
1.74k stars 195 forks source link

Installation with chocolatey doesn't work as described. #688

Open NaridaL opened 2 years ago

NaridaL commented 2 years ago

Describe the issue

I am trying to get kubectl oidc-login to work. According to the docs, choco install kubelogin should be enough. However, it also says that kubectl-oidc_login needs to be available on the path, but as far as I can see, choco install doesn't do that.

Compare choco install krew, which also creates %HOMEPATH%\.krew\bin\kubectl-krew.exe which links to the installed krew.exe.

I'm not sure if this an issue with the docs (i.e. the manual step of copying it to kubectl-oidc_login needs to be done not only for github releases installation, but also for choco), or if the choco package needs to be adjusted to take care of this automatically too.

To reproduce

choco install kubernetes-cli
choco install kubelogin

# in new terminal so path is updated:
kubectl # this works
kubelogin # this works
kubectl oidc-login # this doesnt

Your environment

Edition Windows 10 Pro
Version 21H1
Installed on    ‎06.‎05.‎2021
OS build    19043.1466
Experience  Windows Feature Experience Pack 120.2212.3920.0

C:\Users\aleonhar>kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.3", GitCommit:"816c97ab8cff8a1c72eccca1026f7820e93e0d25", GitTreeState:"clean", BuildDate:"2022-01-25T21:25:17Z", GoVersion:"go1.17.6", Compiler:"gc", Platform:"windows/amd64"}
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.

kubelogin version  (go1.16.12 windows_amd64)
haarchri commented 2 years ago

thanks for the hint - rename kubelogin.exe to kubectl-oidc_login.exe and kubelogin is working

NArnott commented 2 years ago

Renaming the file worked for me, but this took way to long to figure out. Please fix the Choco installer so kubectl-oidc_login.exe exists from the start.

jriesen commented 1 year ago

Just ran into this issue. Looks like Chocolately considers it to be an upstream problem (with this repo), since they receive kubelogin.exe in the zip they are disinclined to rename it or create a symlink. Why is it distributed in the releases as kubelogin.exe anyway, or kubelogin for that matter for Linux... since even the install instructions say to rename it after unzipping?

xehpuk commented 1 year ago

As a workaround, execute this after installation:

&"$env:ChocolateyInstall\tools\shimgen.exe" --output="$env:ChocolateyInstall\bin\kubectl-oidc_login.exe" --path="..\lib\kubelogin\tools\kubelogin.exe"
meilel commented 11 months ago

As a workaround, execute this after installation:

&"$env:ChocolateyInstall\tools\shimgen.exe" --output="$env:ChocolateyInstall\bin\kubectl-oidc_login.exe" --path="..\lib\kubelogin\tools\kubelogin.exe"

This worked for me, but we definitly shouldn't have to do that...