lensapp / lens

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

Mac Lens desktop does not run. #33

Closed jeremy-moore closed 3 years ago

jeremy-moore commented 5 years ago

From Lens-2.0.5.dmg Got email invite to install. Also link to support is broken https://account.kontena.io/support

InAnimaTe commented 5 years ago

Same, takes a kill to actually stop it too :(

kke commented 5 years ago

It's being developed solely on macs so it seems strange. Which version of MacOS?

miskun commented 5 years ago

@nevalla can you take a look at this support link issue

jauco commented 5 years ago

same here. stalls on loading dialog

Lens 2.0.7 (2.0.7.20191002.30) Mac os 10.14.4 (18E226)

jakolehm commented 5 years ago

Try to start Lens via terminal using command: /Applications/Lens.app/Contents/MacOS/Lens

Does it show any errors?

amigold commented 5 years ago

These are the errors I'm seeing

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'certData' of null
    at e.caData (/Applications/Lens.app/Contents/Resources/app.asar/webpack:/src/main/context-handler.ts:49:50)
    at /Applications/Lens.app/Contents/Resources/app.asar/main.js:1:271925
    at Object.next (/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:272030)
    at o (/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:270776)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:7755) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'certData' of null
    at e.caData (/Applications/Lens.app/Contents/Resources/app.asar/webpack:/src/main/context-handler.ts:49:50)
    at /Applications/Lens.app/Contents/Resources/app.asar/main.js:1:271925
    at Object.next (/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:272030)
    at o (/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:270776)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)
(node:7755) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7755) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7755) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:7755) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
jnummelin commented 5 years ago

@amigold that implies that Lens app cannot properly parse & use the kubeconfig. Could you post what kind of kubeconfig you are using, especialy the user part. Rip out any sensitive data naturally. :)

And yes, we need to handle those kind of errors better.

EDIT: 2.0.7 version should handle kubeconfig loading errors bit better.

amigold commented 5 years ago

@jnummelin hopefully this helps?

users:
- name: NAME HERE
  user:
    client-certificate-data: CERTIFICATE DATA HERE
    client-key-data: CLIENT KEY DATA HERE
    password: PASSWORD HERE
    username: admin
- name: NAME HERE
  user:
    password: PASS HERE
    username: USER HERE
jnummelin commented 5 years ago

@amigold thanks. having both client certs and basic auth defined, sounds wrong, not 100% sure that might break things.

Mind pasting the whole kubeconfig with sensitive data ripped out just to inspect which config might cause this.

Oh, and I'm assuming the your kubectl works fine with this config?

amigold commented 5 years ago

@jnummelin kubectl works fine indeed

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: CA DATA
    server: URL
  name: NAME
contexts:
- context:
    cluster: NAME
    user: USER NAME
  name: USER NAME AGAIN
current-context: CLUSTER NAME
kind: Config
preferences: {}
users:
- name: NAME HERE
  user:
    client-certificate-data: CERTIFICATE DATA HERE
    client-key-data: CLIENT KEY DATA HERE
    password: PASSWORD HERE
    username: admin
- name: NAME HERE
  user:
    password: PASS HERE
    username: USER HERE
jnummelin commented 5 years ago

@amigold the only way we've been able to reproduce this is by having malformed kubeconfig where your context config points to non-existing user info. So please tripple check the config.

We are building up a fix where we better validate the info and do not try to load such clusters at all

jakolehm commented 5 years ago

2.0.8 is out with fixes.

Zegorax commented 5 years ago

I've juste updated to 2.0.8, and the app is not running. Here's the error :

info: Set kubectl version 1.16.1 for cluster version v1.15.3 using version map
error: server https://c1.kubesail.com:6443 stderr: (node:11646) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'method' of undefined
    at axios_1.default.then.catch (/snapshot/kontena-k8s-dashboard/build/server/api/kube-request.js:0:0)
    at <anonymous>
(node:11646) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 19)
(node:11646) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
jeremy-moore commented 5 years ago

Same for me. I have upgraded to Lens 2.0.8 (Mac) and does not run (same as previous version).

Jeremy

$ kubectl version Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:13:49Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", BuildDate:"2019-08-19T11:05:16Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"} $ $ kubectl cluster-info Kubernetes master is running at https://192.168.0.180:6443 KubeDNS is running at https://192.168.0.180:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy Metrics-server is running at https://192.168.0.180:6443/api/v1/namespaces/kube-system/services/https:metrics-server:/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. $ /Applications/Lens.app/Contents/MacOS/Lens GVA info: Successfully connected to the Intel plugin, offline Gen9

kke commented 5 years ago

Could this problem persist because the lens cluster store still has some pieces of the broken kubeconfig? Clearing the store could help.

rm -rf $HOME/Library/Application\ Support/Lens will wipe it clean.

jeremy-moore commented 5 years ago

After doing that, I get a colour wheel and title bar "Lens" but then nothing happens. not responding.

Zegorax commented 5 years ago

I tried to wipe the Lens directory, but it did not solve the problem.

keithhubner commented 5 years ago

Yeah doesn't work on OSX, just says cluster is offline, it's definitely not.

nevalla commented 5 years ago

Yeah doesn't work on OSX, just says cluster is offline, it's definitely not.

This cluster is offline might also indicate that Lens app is unable to authenticate to the Kubernetes API with given kubeconfig. Please could you tell what authentication method is used with the cluster?

Zegorax commented 5 years ago

@nevalla @jeremy-moore Could you please try to connect to a Kubesail cluster on MacOS ? The issue should normally happen.

jakolehm commented 5 years ago

@Zegorax @jeremy-moore does this still happen with Lens v2.1.3?

jeremy-moore commented 5 years ago

I now get a menu and the app does not crash. But there is no main window and nothing useful I can do.

BTW kube config context is now a DigitalOcean K8s cluster.

$ kubectl cluster-info Kubernetes master is running at https://e9534cbc-8dbf-4349-b03f-1d4acef7dd4f.k8s.ondigitalocean.com CoreDNS is running at https://e9534cbc-8dbf-4349-b03f-1d4acef7dd4f.k8s.ondigitalocean.com/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

jeremy-moore commented 5 years ago

Are there any requirements for the cluster or config? Are there any assumptions of the MacOS system? eg. versions of things

jakolehm commented 5 years ago

@jeremy-moore try following:

jeremy-moore commented 5 years ago

Yep already did that.

jakolehm commented 5 years ago

Are there any requirements for the cluster or config?

Token and cert based kubeconfigs should work ootb (we have tested also DO). Anyway you should see the app window even if you have exotic configs.

Are there any assumptions of the MacOS system? eg. versions of things

Any recent 64bit MacOS version should work.

Are you still seeing the same errors with the latest Lens version if you run: /Applications/Lens.app/Contents/MacOS/Lens ?

Zegorax commented 5 years ago

I just tried with https://kuber.host. There is no error in the Terminal but no UI is displayed. The cluster is seen as online in the settings. Now, for an unknown reason, a Kubesail cluster won't even pass the verification.

Invalid kubeconfig context kubesail-zegorax: cannot access cluster (kubesail-zegorax)

nevalla commented 5 years ago

I just tried with https://kuber.host. There is no error in the Terminal but no UI is displayed. The cluster is seen as online in the settings.

Issue with Kuber is that user has only limited access to cluster. Lens UI tries to resolve allowed namespaces, but fails since user has no right to list namespaces. However, we could use namespace defined in kubeconfig and assume that user has access to that namespace and display only that namespace in UI.

Issue with Kubesail kubeconfig seems to be that there's totally redundant client-key-data under user section. By removing that, it makes possible to add the cluster. However, since the access to the cluster is very limited it has the same issue as Kuber.

jakolehm commented 5 years ago

Kuber should work with v2.1.4.

miskun commented 5 years ago

I think this issue needs some more clarity. The title "Mac Lens desktop does not run" is not reflecting (anymore) issues we are discussing in here. I'd suggest a) we close this issue and create new one with some focus; or b) update the title of this issue to reflect what is the actual issue that must be solved.

Tl;dr; This issue is not anymore about "Mac Lens desktop does not run". @jeremy-moore can you confirm. If you feel this is still issue, please let us know (after trying with the latest version).

jeremy-moore commented 5 years ago

I still have the original issue "Mac Lens desktop does not run". Although it now shows the title bar, but no main window.

It does not work either with an on-premise cluster or one on DigitalOcean.

Version 2.2.1 (2.2.1.20191023.10)

$ rm -rf $HOME/Library/Application\ Support/Lens $ /Applications/Lens.app/Contents/MacOS/Lens CLUSTER STORE, MIGRATION: 2.0.0-beta.2 Store data now: {"_options":{"configName":"lens-cluster-store","fileExtension":"json","projectSuffix":"nodejs","clearInvalidConfig":true,"accessPropertiesByDotNotation":false,"projectVersion":"2.2.1","migrations":{},"cwd":"/Users/jere/Library/Application Support/Lens"},"events":{"_events":{},"_eventsCount":0},"path":"/Users/jere/Library/Application Support/Lens/lens-cluster-store.json"} GVA info: Successfully connected to the Intel plugin, offline Gen9

jeremy-moore commented 5 years ago

I still have the original issue "Mac Lens desktop does not run". Version 3.1 Are the any logs or any way to debug this?

nevalla commented 5 years ago

@jeremy-moore if you run the latest version from command line: DEBUG=true /Applications/Lens.app/Contents/MacOS/Lens (or correct path to lens app), do you see any errors in output?

jeremy-moore commented 5 years ago

Some result. Don't see any errors.

$ rm -rf $HOME/Library/Application\ Support/Lens
$ DEBUG=true /Applications/Lens.app/Contents/MacOS/Lens
CLUSTER STORE, MIGRATION: 2.0.0-beta.2
Store data now: {"_options":{"configName":"lens-cluster-store","fileExtension":"json","projectSuffix":"nodejs","clearInvalidConfig":true,"accessPropertiesByDotNotation":false,"projectVersion":"2.4.1","migrations":{},"cwd":"/Users/jere/Library/Application Support/Lens"},"events":{"_events":{},"_eventsCount":0},"path":"/Users/jere/Library/Application Support/Lens/lens-cluster-store.json"}
CLUSTER STORE, MIGRATION: 2.4.1
GVA info: Successfully connected to the Intel plugin, offline Gen9
nevalla commented 5 years ago

This is a bit mystery to me now. I don't see the following line in my output (MacBook PRO / Mojave), but it does not look error either

GVA info: Successfully connected to the Intel plugin, offline Gen9

Please could you tell more about your Mac/OS X environment, if I'm able to reproduce this on some other machine.

jeremy-moore commented 5 years ago

Sure. What environment details are you interested in?

miskun commented 4 years ago

Is there any update on this issue? I'd suggest downloading and installing a fresh new version and let's see how it'll go. I can see from the discussion thread that the version we are trying to install here is very old version and many improvements have been made since then.

cyberbeast commented 4 years ago

I am on the latest version. And running into the "cannot parse kubeconfig" error. For me the app was working just fine, until deleting a workspace caused the app to crash and then upon restarting all my configuration was lost and I was back to the screen that would ask me add a new cluster. And when I try to do that, I keep getting slapped with the "cannot parse kubeconfig" error. The Kubeconfig works outside of the app though. Any suggestions?

cyberbeast commented 4 years ago

I've tried reinstalling Lens and re-acquiring my kubeconfig files as well. Nothing seems to help with the issue.

darren271 commented 4 years ago

I'm facing the exact same issues. The output of the log isn't very useful and Kubectl works just fine, as does the K9S project which is similar.

The following output is with version 3.5.1 and version 1.8.6 of Kubectl on a Mac running 10.15.3

╭─darren.thiessen@DTHIESSEN-MBP ~/Applications/Lens.app/Contents/MacOS
╰─➤  $ rm -rf ~/Library/Application\ Support/Lens
╭─darren.thiessen@DTHIESSEN-MBP ~/Applications/Lens.app/Contents/MacOS
╰─➤  $ DEBUG=true ./Lens

debug: Set kubectl version 1.17.4 for cluster version 1.17.4 using version map
CLUSTER STORE, MIGRATION: 2.0.0-beta.2
CLUSTER STORE, MIGRATION: 2.4.1
CLUSTER STORE, MIGRATION: 2.6.0-beta.2
CLUSTER STORE, MIGRATION: 2.6.0-beta.3
CLUSTER STORE, MIGRATION: 2.7.0-beta.0
CLUSTER STORE, MIGRATION: 2.7.0-beta.1
(node:96393) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
    at parseEnv (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/node_modules/shell-env/index.js:15:35)
    at AsyncFunction.module.exports.sync (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/node_modules/shell-env/index.js:47:10)
    at Object.t.shellSync (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/webpack:/src/main/shell-sync.ts:15:1)
    at App.<anonymous> (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:323139)
    at /Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:322433
    at Object.next (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:322538)
    at /Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:321451
    at new Promise (<anonymous>)
    at n (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:321199)
    at App.protocol (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/webpack:/src/main/index.ts:32:3)
    at App.emit (events.js:205:15)
(node:96393) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'split' of undefined
    at parseEnv (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/node_modules/shell-env/index.js:15:35)
    at AsyncFunction.module.exports.sync (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/node_modules/shell-env/index.js:47:10)
    at Object.t.shellSync (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/webpack:/src/main/shell-sync.ts:15:1)
    at App.<anonymous> (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:323139)
    at /Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:322433
    at Object.next (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:322538)
    at /Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:321451
    at new Promise (<anonymous>)
    at n (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/main.js:1:321199)
    at App.protocol (/Users/darren.thiessen/Applications/Lens.app/Contents/Resources/app.asar/webpack:/src/main/index.ts:32:3)
    at App.emit (events.js:205:15)
(node:96393) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:96393) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:96393) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:96393) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
jakolehm commented 4 years ago

Is this still a problem?

darren271 commented 4 years ago

For me it was/is. I think I was able to resolve it. After switching OSX's default shell from ZSH to BASH it's now working. I was getting the following error which lead me to believe it might be an issue with the default shell:

error: shellEnv: Error: Command failed: /bin/bash -ilc echo -n "_SHELL_ENV_DELIMITER_"; env; echo -n "_SHELL_ENV_DELIMITER_"; exit
bash: no job control in this shell
hojerst commented 3 years ago

Today I ran into the same problem: It seems Lens is running some shell commands and actually runs this shell in interactive mode which seems to be a bug imho. In my case a script (zsh-abbr) came to an halt and blocked the opening of the main window.

After removing zsh-abbr from my zsh plugins everything worked again. Nevertheless IMHO this is a bug of lens as a non-interactive shell should be used for scripts.

(Lens 2.0.8)

kke commented 3 years ago

After removing zsh-abbr from my zsh plugins everything worked again. Nevertheless IMHO this is a bug of lens as a non-interactive shell should be used for scripts.

Lens needs to fake an interactive shell for the terminal so it can set the PATH to kubectl and KUBECONFIG. For this to work properly, it needs to figure out the env of an interactive shell so that it can duplicate it on a non-login shell. Also I think it may want the KUBECONFIG of a login shell on startup.

There may be some better way to do it.

OneideLuizSchneider commented 3 years ago

Quit Lens then delete the folder ~/Library/Application Support/Lens After just open again. I'm using macOS.

Nokel81 commented 3 years ago

This is related to an unsupported version of Lens. Please open a new issue if this continues to happen with the latest (4.1.4) version.

alex-kovalchuk commented 3 years ago

It works via sudo: sudo /Applications/Lens.app/Contents/MacOS/Lens