lensapp / lens

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

Lens not working correctly when kubelogin auth is used #6427

Closed aleexx17 closed 1 year ago

aleexx17 commented 1 year ago

Describe the bug We have AKS Kubernetes Clusters to authenticate we now use the azure kubelogin (https://github.com/Azure/kubelogin) since the azure auth plugin is deprecated in the versions v.1.22+ I've noticed, that in Lens I can only connect to the clusters when I'm using the azure auth plugin. As soon as I use kubelogin I get the follwing error:

getting credentials: exec: executable kubelogin 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

I also tried to set the absoloute path for the kubelogin command, but I get the same error.

getting credentials: exec: executable /home/linuxbrew/.linuxbrew/opt/kubelogin/bin/kubelogin 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

But I am able to connect to my cluster via kubectl.

To Reproduce Steps to reproduce the behavior:

  1. Open Lens
  2. Click on the cluster with the kubelogin auth and try to connect

Expected behavior I'm able to connect to the cluster and authenticate with kubelogin.

Environment (please complete the following information):

Kubeconfig:

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: mycacertificate
    server: https://my-aks-cluster:443
  name: my-aks-cluster
contexts:
- context:
    cluster: my-aks-cluster
    user: clusterUser_my-aks-cluster
  name: my-aks-cluster
current-context: my-aks-cluster
kind: Config
preferences: {}
users:
- name: clusterUser_mgb-my-aks-cluster
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - get-token
      - --environment
      - AzurePublicCloud
      - --server-id
      - my-server-id
      - --client-id
      - my-client-id
      - --tenant-id
      - my-tenant-id
      - --login
      - devicecode
      command: kubelogin
      env: null
      interactiveMode: IfAvailable
      provideClusterInfo: false

Additional context Add any other context about the problem here.

Nokel81 commented 1 year ago

Do you see a notification about "failed to sync shell env"?

aleexx17 commented 1 year ago

No I don't see that, but I was able to figure out why it wasn't working. I normally use WSL when I'm working with Kubernetes so I synced the kubeconfig file from the WSL. So to see if that was the problem I installed everything on my windows host too. I tried to sync the kubeconfig file from my windows host which worked after I changed the path to the absoloute path to the kubelogin exe.