micahhausler / k8s-oidc-helper

Helper tool for authenticating to Kubernetes using Google's OpenID Connect
MIT License
201 stars 86 forks source link

k8s-oidc-helper: command not found #3

Closed spnzig closed 7 years ago

spnzig commented 7 years ago

I installed the k8s-oidc-helper package with go using go get github.com/micahhausler/k8s-oidc-helper and it gave me permission issues. But then i ran it with sudo and it worked. But when i try k8s-oidc-helper --version it gives command not found I am using a VM running Ubuntu 16.04LTS for this. kubernetes version - v1.7.2

micahhausler commented 7 years ago

How do you have go installed? What version of go are you using? Typically you shouldn't have to use sudo. I'm guessing you installed go as root, which is why you needed to use sudo.

Go uses the GOPATH environment variable to know where to install packages. I'm guessing since you installed with root, the gopath is something like /root/go, but only for the root user.

When you go get, it installs the binary at $GOPATH/bin, so if that directory is not in your $PATH, your shell would not be able to find the command.

The easier way to do this might be to use your (non-root) user account and:

echo "export GOPATH=$HOME/go" >> ~/.profile
echo "export PATH=$GOPATH/bin" >> ~/.profile
source ~/.profile

go get github.com/micahhausler/k8s-oidc-helper