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

external auth (exec) not working (azure/kubelogin and aws-iam-authenticator) #1885

Open
hofq opened this issue Mar 28, 2024 · 7 comments · May be fixed by #1908
Open

external auth (exec) not working (azure/kubelogin and aws-iam-authenticator) #1885

hofq opened this issue Mar 28, 2024 · 7 comments · May be fixed by #1908
Assignees
Labels
AKS Related to Azure Kubernetes Engine auth backend Issues related to the backend EKS Related to Amazon Elastic Kubernetes Service enhancement New feature or request
Milestone

Comments

@hofq
Copy link

hofq commented Mar 28, 2024

I tried connecting to our prod clusters using "azure/kubelogin" and aws-iam-authenticator.

None of these Auth Methods worked.

Is there an eta we can expect exec auth to work? We want to switch from the closed source software lens to headlamp, but this is currently blocking.

@illume
Copy link
Contributor

illume commented Mar 29, 2024

Hi.

Thanks for writing.

Yeah, we use the k8s APIs rather than kubectl and haven't implemented support for the "client-go credential plugins".

As a not-great work around authentication for both AKS and EKS can be done with OIDC. I realize this is probably not suitable however. Because the point of the aws-iam-authenticator is to avoid having to manage separate services. (please correct me if I'm wrong?)

Supporting external auth commands isn't currently on the short term roadmap. But I personally think it's something we should support.


External auth related docs

exec:
    apiVersion: ...
    command: ...
    args: ...

Other related issues:

A number of others have reported here and elsewhere wanting support for external auth commands.

Here are some of the github issues:

@illume illume added enhancement New feature or request backend Issues related to the backend auth AKS Related to Azure Kubernetes Engine EKS Related to Amazon Elastic Kubernetes Service labels Mar 29, 2024
@gaeljw
Copy link

gaeljw commented Mar 31, 2024

I agree this will be a must have for most companies.

@strowi
Copy link

strowi commented Mar 31, 2024

Would also like for this to work. I'm guessing there are a lot of people using some form of client-side addon (e.g. i am using passman to store the credentials in keychain):

- name: rancher
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - keychain
      - user@cluster
      command: kubectl-passman
      env: null
      interactiveMode: IfAvailable
      provideClusterInfo: false

@lindblombr
Copy link

From #1716 I've been able to get this working like so

Can confirm what @kdeyko says. I have a similar issue with a custom OIDC binary we invoke from exec. If we open the app through point-and-click (macOS), we just get bad gateway and lots of errors in the dev console connecting to localhost. If I open up in a terminal via /Applications/Headlamp.app/Contents/MacOS/Headlamp, everything works perfectly.

Could be a work-around until the underlying connectivity issue is resolved?

@lindblombr
Copy link

lindblombr commented Apr 1, 2024

On macos, I've used the following work-around to make this work via native Finder/Dock/Spotlight launch

$ sudo launchctl config user path /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/homebrew/bin

This ensures that the paths where my exec plugins are located are in the environment of every application I launch via Finder et al. Unfortunately, the change requires root and a reboot, but successfully unblocks Headlamp in local GUI mode to work properly with exec configuration.

Incorporating something similar to shell-path in the electron startup should allow Headlamp to inherit user-configured PATH environment so that Headlamp works as expected: https://github.com/sindresorhus/shell-path (hopefully there is a newer, maintained dependency). Headlamp appears to implement kubeconfig handling in a way that already supports exec so long as any executable referenced by exec is either absolute path or IN the search PATH. TL;DR, enabling this feature seems to only require fixing the way Headlamp launches with respect to incorporating/honoring user-configured PATH that tools like kubectl already depend on.

@illume
Copy link
Contributor

illume commented Apr 2, 2024

Thanks @lindblombr

@illume illume self-assigned this Apr 15, 2024
@illume illume added this to the v0.24.0 milestone Apr 15, 2024
illume added a commit that referenced this issue Apr 15, 2024
On at least MacOS, GUI apps do not take on the shell paths.
However they are needed for kubectl auth plugins,
and perhaps other binaries like minikube

Fixes #1885

Signed-off-by: René Dudfield <[email protected]>
@illume illume linked a pull request Apr 15, 2024 that will close this issue
illume added a commit that referenced this issue Apr 15, 2024
On at least MacOS, GUI apps do not take on the shell paths.
However they are needed for kubectl auth plugins,
and perhaps other binaries like minikube

Fixes #1885

Signed-off-by: René Dudfield <[email protected]>
@illume illume changed the title external auth (exec) not working external auth (exec) not working (azure/kubelogin and aws-iam-authenticator) Apr 15, 2024
illume added a commit that referenced this issue Apr 15, 2024
On at least MacOS, GUI apps do not take on the shell paths.
However they are needed for kubectl auth plugins,
and perhaps other binaries like minikube

Fixes #1885

Signed-off-by: René Dudfield <[email protected]>
illume added a commit that referenced this issue Apr 15, 2024
On at least MacOS, GUI apps do not take on the shell paths.
However they are needed for kubectl auth plugins,
and perhaps other binaries like minikube

Fixes #1885

Signed-off-by: René Dudfield <[email protected]>
@pg185210
Copy link

pg185210 commented May 8, 2024

Hi.

Thanks for writing.

Yeah, we use the k8s APIs rather than kubectl and haven't implemented support for the "client-go credential plugins".

As a not-great work around authentication for both AKS and EKS can be done with OIDC. I realize this is probably not suitable however. Because the point of the aws-iam-authenticator is to avoid having to manage separate services. (please correct me if I'm wrong?)

Supporting external auth commands isn't currently on the short term roadmap. But I personally think it's something we should support.

External auth related docs

exec:
    apiVersion: ...
    command: ...
    args: ...

Other related issues:

A number of others have reported here and elsewhere wanting support for external auth commands.

Here are some of the github issues:

Yep, I'd love that. OpenLens picks up my AWS EKS context and connects to the clusters out of the box. Headlamp recognizes the contexts, but just shows "Bad Gateway" status for the clusters. I guess I'll stay with OpenLens for now :(

edit2:
Oh wait, yes, looks like it's exactly the problem:

16:18:10.725 › server process stderr: 2024/05/08 16:18:10 http: proxy error: getting credentials: exec: executable aws not found

It looks like you are trying to use a client-go credential plugin that is not installed.

To learn more about this feature, consult the documentation available at:
      https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins

thats what my kube config looks like:

- name: arn:aws:eks:us-west-2:011111111111:cluster/mycluster1
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - --region
      - us-west-2
      - eks
      - get-token
      - --cluster-name
      - mycluster1
      - --output
      - json
      command: aws

illume added a commit that referenced this issue May 11, 2024
On at least MacOS, GUI apps do not take on the shell paths.
However they are needed for kubectl auth plugins,
and perhaps other binaries like minikube

Fixes #1885

Signed-off-by: René Dudfield <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AKS Related to Azure Kubernetes Engine auth backend Issues related to the backend EKS Related to Amazon Elastic Kubernetes Service enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants