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

User Exec command "/usr/local/bin/aws" not found on host. #2079

Closed
zaf187 opened this issue Feb 3, 2021 · 14 comments · Fixed by #3664 or #3881
Closed

User Exec command "/usr/local/bin/aws" not found on host. #2079

zaf187 opened this issue Feb 3, 2021 · 14 comments · Fixed by #3664 or #3881
Assignees
Labels
bug Something isn't working
Milestone

Comments

@zaf187
Copy link

zaf187 commented Feb 3, 2021

Describe the bug
I am using Lens on Windows, all my interactions with a kubenetes cluster i perform via kubectl installed on Windows Subsystem for Linux (WSL). I have also installed aws cli on WSL. My kubeconfig file is in WSL, i am able to reference the file in Lens using the path \\wsl$\Ubuntu-18.04\home\user\.kube
When i try to use one of my aws eks clusters, i get the above error message. I am assuming it's because it's trying to use aws cli from windows.

Is there any way to get it working without having to install aws cli in two places (WSL and Windows)?

To Reproduce
Steps to reproduce the behavior:
Use a kubeconfig file that contains a reference an aws eks cluster, see below.

The problem arises where the command: /usr/local/bin/aws has been defined, i added the fully qualified path but that hasn't helped.

Expected behavior
It should be able to load the cluster

Environment (please complete the following information):

  • Lens Version: 4.0.8
  • OS: Windows 10 Pro
  • Installation method (e.g. snap or AppImage in Linux): From websiteusing installer
  • WsL: Ubuntu 18.04

Logs:
When you run the application executable from command line you will see some logging output. Please paste them here:

User Exec command "/usr/local/bin/aws" not found on host.

Kubeconfig:
Quite often the problems are caused by malformed kubeconfig which the application tries to load. Please share your kubeconfig, remember to remove any secret and sensitive information.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: 
    server: https://asdfasdfasdfasdfasd.gr7.us-east-2.eks.amazonaws.com
  name: arn:aws:eks:us-east-2:999999999999:cluster/xxxxxxx-1
contexts:
- context:
    cluster: arn:aws:eks:us-east-2:999999999999:cluster/xxxxxxx-1
    namespace: xxxxxxx-rc5
    user: arn:aws:eks:us-east-2:999999999999:cluster/xxxxxxx-1
  name: arn:aws:eks:us-east-2:999999999999:cluster/xxxxxxx-1
current-context: arn:aws:eks:us-east-2:999999999999:cluster/xxxxxxx-1
kind: Config
preferences: {}
users:
- name: arn:aws:eks:us-east-2:999999999999:cluster/xxxxxxx-1
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      args:
      - --region
      - us-east-2
      - eks
      - get-token
      - --cluster-name
      - xxxxxxx-1
      - --role
      - arn:aws:iam::999999999999:role/xxxxxxx-1-cluster-admin
      command: /usr/local/bin/aws
      env:
      - name: AWS_PROFILE
        value: xxxxxxx-eks
@zaf187 zaf187 added the bug Something isn't working label Feb 3, 2021
@zaf187
Copy link
Author

zaf187 commented Feb 3, 2021

I got it working after installing aws on Windows, i had to configure it all up again.

@jim-docker
Copy link
Contributor

related to #2087

@levissssss
Copy link

Got a workaround that aliases the aws command from WSL:

  1. Create a file in windows aws.bat:
@echo off
echo.
wsl aws %*
  1. Add this to your PATH in windows.
  2. Restart (might not be needed but didn't work for me until I did)

@nevalla
Copy link
Contributor

nevalla commented Feb 18, 2021

Another workaround is to copy paste the kubeconfg to Lens and set wsl as command and move aws to args:

- user:
    ...
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: wsl
      args:
      - aws      
      - eks
      - get-token
      ...

Also noticed that in order to get env variables present in Kubeconfig passed properly to wsl command you need to add those into WSLENV environment variable, for example:

AWS_PROFILE/u

or move those to args in Kubeconfig

@Ajay250496
Copy link

Another workaround is to copy paste the kubeconfg to Lens and set wsl as command and move aws to args:

- user:
    ...
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: wsl
      args:
      - aws      
      - eks
      - get-token
      ...

Also noticed that in order to get env variables present in Kubeconfig passed properly to wsl command you need to add those into WSLENV environment variable, for example:

AWS_PROFILE/u

or move those to args in Kubeconfig

Did you actually get this working with multiple profiles?

I've configured my kubeconfig similar to yours and tried to use WSLENV like this WSLENV=AWS_PROFILE/u but it does not seem to take effect. It takes my credentials in the default profile, rather than switches between multiple AWS_PROFILE's

@ashtonian
Copy link

ashtonian commented Aug 23, 2021

same issue on mac os, installed with homebrew, aws is in path, I believe this was fixed and it regressed.

#2290

@Nokel81 Nokel81 added this to the 5.2.1 milestone Aug 23, 2021
@Nokel81 Nokel81 self-assigned this Aug 23, 2021
@ashtonian
Copy link

Uninstalling lens via brew and reinstalling binary directly worked.

@Nokel81
Copy link
Collaborator

Nokel81 commented Aug 23, 2021

@ashtonian interesting... hopefully The PR I just opened fixes the issue even for homebrew users.

@Vanheelsing
Copy link

Case #3683 is not the same as i am not using WSL yet i got my case closed and i still can't use lens on native windows while my kubectl and aws both work under powershell and cmd

@Nokel81
Copy link
Collaborator

Nokel81 commented Aug 26, 2021

@Vanheelsing Hopefully #3664 will fix it for you

@drlarsen77
Copy link

Got a workaround that aliases the aws command from WSL:

  1. Create a file in windows aws.bat:
@echo off
echo.
wsl aws %*
  1. Add this to your PATH in windows.
  2. Restart (might not be needed but didn't work for me until I did)

Thanks for the tip! You can also skip adding it to your path by creating the file at %LOCALAPPDATA%\Programs\Lens\aws.bat

@manuelnucci
Copy link

manuelnucci commented May 17, 2023

@drlarsen77 couldn't find that specific folder. Usually inside %LOCALAPPDATA% there are Local, LocalRow and Roaming folders. Maybe it's one of those?

@drlarsen77
Copy link

@manuelnucci I'm not sure where you're looking, but %LOCALAPPDATA% is a user environment variable that always points to C:\Users\username\AppData\Local -- that's why it's part of the name. :)

@manuelnucci
Copy link

My mistake, I was looking somewhere else! Thanks for the tip then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.