devops-works / binenv

One binary to rule them all. Manage all those pesky binaries (kubectl, helm, terraform, ...) easily.
MIT License
372 stars 44 forks source link

documentation/possibility how to handle sudo calls? #86

Closed deknos closed 3 years ago

deknos commented 3 years ago

Hello, i start after a while stumbling often enough with sudo and tools i installed with binenv. Can you add a documentation which best practice you would recommend, so tools are usable with sudo? because otherweise minikube for example is not really usable

leucos commented 3 years ago

Hello,

Can you describe what issues you're facing ? Minikube is happy here.

$ which minikube
/home/dir/.binenv/minikube
$ minikube start
πŸ˜„  minikube v1.14.2 sur Ubuntu 20.04
...
🚜  Pulling base image ...
πŸ’Ύ  Downloading Kubernetes v1.19.2 preload ...
    > preloaded-images-k8s-v6-v1.19.2-docker-overlay2-amd64.tar.lz4: 486.33 MiB
πŸ”₯  Creating docker container (CPUs=2, Memory=16000MB) ...
...
πŸ”Ž  Verifying Kubernetes components...
🌟  Enabled addons: storage-provisioner, default-storageclass
πŸ„  Done! kubectl is now configured to use "minikube" by default
$ kubectl get nodes
NAME       STATUS   ROLES    AGE   VERSION
minikube   Ready    master   25s   v1.19.2
deknos commented 3 years ago

Here:

user01@testvm:~$ minikube start --driver=none
πŸ˜„  minikube v1.17.1 auf Ubuntu 20.04 (vbox/amd64)
✨  Using the none driver based on user configuration

🀷  Exiting due to PROVIDER_NONE_NOT_FOUND: The 'none' provider was not found: running the 'none' driver as a regular user requires sudo permissions

user01@testvm:~$ sudo minikube start --driver=none
[sudo] Passwort fΓΌr benutzer01: 
sudo: minikube: Befehl nicht gefunden
user01@testvm:~$
leucos commented 3 years ago

This might work:

sudo env "PATH=$PATH" "HOME=$HOME" minikube start --driver=none

I do not see any easier safe global solution to this.

A global binenv mode where binaries & configs would be shared for the entire system would solve this, but is not really in the plans right now.

EDIT: there is also the option of installing binenv for the root user.

deknos commented 3 years ago

This looks good enough, perhaps you should mention it in the documentation, at least that works for me :)

deknos commented 3 years ago

sadly you only can use it then as root, not as non-root when you install it with root in /usr/local/bin :D