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

Support kubectl alias if command is not in your path #1514

Open
cawoodm opened this issue Mar 28, 2022 · 4 comments
Open

Support kubectl alias if command is not in your path #1514

cawoodm opened this issue Mar 28, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@cawoodm
Copy link

cawoodm commented Mar 28, 2022




Is your feature request related to a problem? Please describe.
It would be nice if K9S would pick op on a kubectl alias where the actual kubectl executable is not installed but available via an alias.

Describe the solution you'd like
When using K3S or MicroK8S there is no kubectl executable anywhere but rather microk8s kubectl is used. Most users define an alias kubectl='microk8s kubectl' which lets ordinary users work with the kubectl alias. K9S does not recognise this but is searching for a file called kubectl on the PATH.

Describe alternatives you've considered
No ideas.

Additional context
Add any other context or screenshots about the feature request here.

image

image

@derailed derailed added the enhancement New feature or request label Apr 1, 2022
@JefeDavis
Copy link

@cawoodm in the short term you could make a small wrapper and put it in your path aka

!# /bin/sh

microk8s kubectl $@

@JefeDavis
Copy link

I am actually curious why the kubectl binary is needed at all since several of the cli-runtimes for kubectl are already being imported, it should be possible to use the exposed go modules for everything and only require the binary if a plugin needs it

@vicaya
Copy link

vicaya commented May 5, 2022

@cawoodm in the short term you could make a small wrapper and put it in your path aka

!# /bin/sh

microk8s kubectl $@

This doesn't work, as k9s appears to rely on $KUBECONFIG (e.g. ~/.kube/config). microk8s kubectl and friends are sandboxed elsewhere by snap.
mkdir -p ~/.kube && microk8s config > ~/.kube/config (once per microk8s (re)install) before running the wrapper script would work though, unless k9s itself is installed via snap, which requires explicit k9s --kubeconfig=....

@cawoodm
Copy link
Author

cawoodm commented May 6, 2022

It’s actually a pain to rely on kubectl too much since some versions (like k3s) do weird things like ignore ~/.kube/config preferring /etc/rancher/k3s/k3s.yaml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants