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

Can't connect to clusters (with OIDC) #5976

Closed
emmedema opened this issue Aug 3, 2022 · 12 comments · Fixed by #6589
Closed

Can't connect to clusters (with OIDC) #5976

emmedema opened this issue Aug 3, 2022 · 12 comments · Fixed by #6589
Labels
bug Something isn't working

Comments

@emmedema
Copy link

emmedema commented Aug 3, 2022

Describe the bug

I am trying to connect to my company's Kubernetes clusters from my work laptop. All works fine via command line (kubectl ...) and via k9s, but I cannot get Lens to work.

When I try to connect to any of my configured clusters, I get the errors I describe below:

  • either the kubectl executable is not found
  • or some plugins are not found (oidc-login)

I also tried to specify the path of kubectl explicitly in Settings: /usr/bin/kubectl, but that made no difference.

I am not sure what exactly the problem could be, but it almost looks like something related to loading the shell profile is a bit broken, because, as I mentioned, everything works via Command Line (and k9s launched via command line).

Also, I see this at the start of my logs:

error:   ▪ shellEnv: Error: Resolving shell environment is taking very long. Please review your shell configuration.

To Reproduce
I am not sure how to make this reproducible to someone else, but for me, it happens every single time I try to connect to a cluster.

Expected behavior
I would expect to be able to connect to the cluster fine, given that:

  • I can user kubectl via CLI and it works perfectly fine
  • I can use k9s and it works perfectly fine

Environment (please complete the following information):

  • Lens Version: latest 6.0.0-latest.20220728.2, but it was happening in all 5.x I tried
  • OS: Ubuntu 20.04
  • Installation method: downloaded the .deb from the webpage
  • I use ZSH (with Oh-My-Zsh)
  • I tried to execute the lens executable both from command line (both from bash or zsh) and from the window manager

Logs:
This is the error I can see in the log:

error:   ▪ [CLUSTER]: Failed to connect to "citi": StatusCodeError: 500 - "getting credentials: exec: executable kubectl not found\n\nIt looks like you are trying to use a client-go credential plugin that is not installed.\n\nTo learn more about this feature, consult the documentation available at:\n      https://kubernetes.io/docs/reference/access-authn-authz/authentication/#client-go-credential-plugins\n"

Kubeconfig:

- name: cel-1
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1beta1
      args:
      - oidc-login
      - get-token
      - --oidc-issuer-url=....
      - --oidc-client-id=cel-1
      - --oidc-client-secret=.....
      - --oidc-extra-scope=email
      - --oidc-extra-scope=groups
      - --listen-address=127.0.0.1:18000
      command: kubectl
      env: []
      interactiveMode: IfAvailable
      provideClusterInfo: false

Additional context
I also tried to change the kubeconfig to use command: /usr/bin/kubectl, and the error message change to:

error:   ▪ [CLUSTER]: Failed to connect to "develop": StatusCodeError: 500 - "getting credentials: exec: executable /usr/bin/kubectl failed with exit code 1\n" +71ms

And it looks like this in the UI:
error

@emmedema emmedema added the bug Something isn't working label Aug 3, 2022
@jim-docker
Copy link
Contributor

If you're seeing this error:

error:   ▪ shellEnv: Error: Resolving shell environment is taking very long. Please review your shell configuration.

then it likely means that Lens does not have the right environment set up to access your clusters. Is there something in your shell setup/profile that requires user input or delays the starting of a shell?

@DISSIDIA-986
Copy link

encountered the same error as @emmedema , Lens version(Both intel and Arm):
Lens: 6.0.0-latest.20220728.2
Electron: 15.5.7
Chrome: 94.0.4606.81
Node: 16.5.0

error:   ▪ [CLUSTER]: Failed to connect to "xxxxxx": StatusCodeError: 502 - undefined +14ms
^@[LENS-SPACES-EXTENSION] Error getSpaceCa(), retrying... Error: Catalog api missing for Space dissidia-986
    at e.i.backOff.startingDelay [as request] (/Users/xxx/Library/Application Support/Lens/node_modules/lenscloud-lens-extension/dist/main.js:9:245499)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

@nabokihms
Copy link

Hello, dear developers. I faced the same error today. MacBook 2019 Pro (Intel).

What can we do? I believe it previously worked. Something was broken between the 5 and 6 releases.

@wbdan
Copy link

wbdan commented Nov 15, 2022

Same here,

Lens: 2022.11.101953-latest
MBP 13" M2 2022
OS: Ventura 13.0.1

Just installed.
Wanted to give lens a try.

@Nokel81
Copy link
Collaborator

Nokel81 commented Nov 15, 2022

@wbdan Are you seeing the exact same error as above?

@wbdan
Copy link

wbdan commented Nov 16, 2022

Here is a Screenshot:
lens-no-oidc

@Nokel81
Copy link
Collaborator

Nokel81 commented Nov 16, 2022

Are you seeing error: ▪ shellEnv: Error: Resolving shell environment is taking very long. Please review your shell configuration. in your logs?

@wbdan
Copy link

wbdan commented Nov 16, 2022

No I do not.

Log lines containing shell I see:
$ grep -r shell .
./lens3.log:info: 🐚 Syncing shell environment
./lens3.log:info: [UNIX-SHELL-ENV]: running against /bin/zsh {"command":"'/Applications/Lens.app/Contents/MacOS/Lens' -p '"6cac0e7a5bbd4d2e8fa686904e281cbc" + JSON.stringify(process.env) + "6cac0e7a5bbd4d2e8fa686904e281cbc"'","shellArgs":["-l","-i"]}
./lens3.log:info: [SHELL-SYNC]: Synced shell env
./lens2.log:info: 🐚 Syncing shell environment
./lens2.log:info: [UNIX-SHELL-ENV]: running against /bin/zsh {"command":"'/Applications/Lens.app/Contents/MacOS/Lens' -p '"514a03740761468c8c2e9e286306876d" + JSON.stringify(process.env) + "514a03740761468c8c2e9e286306876d"'","shellArgs":["-l","-i"]}
./lens2.log:info: [SHELL-SYNC]: Synced shell env

While seeing this I wondered that lens uses zsh although I have set "/opt/local/bin/bash" in Preferences:Terminal:TerminalShellPath.

Next I tryed launching Lens with "open Lens.app" in iTerm (Path: /Applications) using my default bash.
And now it works.

Closing the App and launching again from the Desktop, I have again the Error above.

@Nokel81
Copy link
Collaborator

Nokel81 commented Nov 16, 2022

oh thanks for this. That is probably the issue, we are not using the correct shell.

@Nokel81
Copy link
Collaborator

Nokel81 commented Nov 16, 2022

I think we only read the OS configured user shell

@wbdan
Copy link

wbdan commented Nov 21, 2022

Hi,

today I`ve updated to:
Lens: 2022.11.210737-latest

But the situation is still the same.

Log:
User@macbook:~/Library/Logs/Lens$ cat lens1.log | grep -i shell
info: 🐚 Syncing shell environment
info: [UNIX-SHELL-ENV]: running against /bin/zsh {"command":"'/Applications/Lens.app/Contents/MacOS/Lens' -p '"feb0c4678bca4ec49ace7b725e490075" + JSON.stringify(process.env) + "feb0c4678bca4ec49ace7b725e490075"'","shellArgs":["-l","-i"]}

Config:
User@macbook:~/Library/Application Support/Lens$ cat ./lens-user-store.json
{
"lastSeenAppVersion": "0.0.0",
"internal": {
"migrations": {
"version": "6.1.19-latest.1669016492629"
}
},
"preferences": {
"shell": "/opt/local/bin/bash",
"terminalTheme": "lens-dark",
"downloadKubectlBinaries": false,
"kubectlBinariesPath": "/opt/local/bin/kubectl/",
"editorConfiguration": {
"tabSize": 2,
"lineNumbers": "on",
"fontSize": 12,
"fontFamily": "RobotoMono",
"minimap": {
"enabled": true,
"side": "right"
}
},
"terminalConfig": {
"fontSize": 12,
"fontFamily": "RobotoMono"
},
"updateChannel": "latest"
}
}

In my Setup the System Shell is the default ("/bin/zsh") in MacOS for Compatibility Reasons.
For my daily Work I use bash from MacPorts.

@Nokel81
Copy link
Collaborator

Nokel81 commented Nov 21, 2022

@wbdan The big fix will be out at post of our next release. The update today covered other bug fixes.

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.

6 participants