lensapp / lens

Lens - The way the world runs Kubernetes
https://k8slens.dev/
MIT License
22.41k stars 1.45k forks source link

How can I run Lens with 'gimme-aws-creds'? #6958

Open pranav-bhatt opened 1 year ago

pranav-bhatt commented 1 year ago

Hi!

In my setup, I need to acquire temporary AWS credentials using gimme-aws-creds before accessing my clusters. Without these temporary credentials, I get the following error:

could not get token: NoCredentialProviders: no valid providers in chain. Deprecated.
    For verbose messaging see aws.Config.CredentialsChainVerboseErrors

Unable to connect to the server: getting credentials: exec: executable aws-iam-authenticator failed with exit code 1

I run an M1 mac, and when I launch the lens application, these credentials haven't got generated and stored as local env variables. This causes the above message to pop up for me, and I'm therefore not able to connect to my clusters.

Is it possible to somehow run gimme-aws-config in the same context as Lens? I noticed there was a path that could be provided for a terminal. If I put a script over there which runs gimme-aws-config before hand, will that work?

Thanks!

Nokel81 commented 1 year ago

Why not run it as part of the exec field in your kubeconfig's user?

pranav-bhatt commented 1 year ago

So the tool requires user input for verification purposes. Not sure if adding it to the exec field would allow me to input details.

Nokel81 commented 1 year ago

Ah I see. Can you call it yourself and then run Lens from the terminal?

pranav-bhatt commented 1 year ago

Hey, sorry for the late reply. I've been trying to install the Lens CLI, but the install button doesn't seem to do anything after prompting for the password (I'm running macOS 12.6)

Nokel81 commented 1 year ago

No I mean running something like /Applications/Lens.app/Contents/MacOS/Lens

pranav-bhatt commented 1 year ago

Yeah I tried with that, and ran it with sudo as well, but no luck. Still got the authentication error.

dennisshpits commented 1 year ago

Lens should work with gimme-aws-creds already. When you run gimme-aws-creds it should generate a credentials file that is under the .aws folder. You might need to set this up. Once you do that you might have to configure your kube config files to look at the credentials file. Anyway this isn’t an issue with Lens. Good luck!