lensapp / lens

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

Cannot install Metrics Stack: operation not permitted (kubectl.exe) #2984

Closed nebula2 closed 3 years ago

nebula2 commented 3 years ago

Describe the bug On my Windows 10 x64 machine with Lens installed - when trying to install the metrics stack for my Rpi k3s cluster I get an error saying:


Uncaught Exception:
Error: EPERM: operation not permitted, open
'C:\Users\jackf\AppData\Roaming\Lens\binaries\kubectl\1.21.1+k3s1\kubecl.exe'

To Reproduce Steps to reproduce the behavior:

  1. Right-click on your cluster and click on settings
  2. Under Features->Metrics Stack click on 'Install'
  3. See error

Expected behavior Prometheus stack get's installed

Screenshots image

Environment (please complete the following information):

Logs: When you run the application executable from command line you will see some logging output. Please paste them here:

C:\Repos> cd "C:\Program Files\Lens"
C:\Program Files\Lens> .\Lens.exe
C:\Program Files\Lens>
info: πŸ“Ÿ Setting Lens as protocol client for lens://
info: πŸ“Ÿ succeeded βœ…

(that is the end - nothing is really logged)

EDIT: Found logs in appdata:

error: [LENS-PROXY]: Failed to write headers: Cannot render headers after they are sent to the client {"code":"ERR_HTTP_HEADERS_SENT","stack":"Error [ERR_HTTP_HEADERS_SENT]: Cannot render headers after they are sent to the client\n    at ServerResponse.writeHead (_http_server.js:273:13)\n    at ProxyServer.<anonymous> (C:\\Program Files\\Lens\\resources\\app.asar\\static\\build\\main.js:1:158674)\n    at ProxyServer.emit (C:\\Program Files\\Lens\\resources\\app.asar\\node_modules\\eventemitter3\\index.js:210:27)\n    at ClientRequest.proxyError (C:\\Program Files\\Lens\\resources\\app.asar\\node_modules\\http-proxy\\lib\\http-proxy\\passes\\web-incoming.js:165:18)\n    at ClientRequest.emit (events.js:223:5)\n    at Socket.socketErrorListener (_http_client.js:406:9)\n    at Socket.emit (events.js:223:5)\n    at emitErrorNT (internal/streams/destroy.js:92:8)\n    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)\n    at processTicksAndRejections (internal/process/task_queues.js:81:21)"}
info: [CLUSTER]: disconnect {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":false,"online":false,"accessible":false,"disconnected":true}
info: [CLUSTER]: unbind events {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":false,"online":false,"accessible":false,"disconnected":true}
info: SERVICE:QUIT
info: πŸ“Ÿ Setting Lens as protocol client for lens://
info: πŸ“Ÿ succeeded βœ…
info: πŸš€ Starting Lens from "C:\Users\jackf\AppData\Roaming\Lens"
info: 🐚 Syncing shell environment
info: πŸ’Ύ Loading stores
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-cluster-store.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-extensions.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-filesystem-provisioner-store.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-workspace-store.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-user-store.json
info: πŸ”‘ Getting free port for LensProxy server
info: [CLUSTER-MANAGER]: init cluster {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":false,"ready":false,"online":false,"accessible":false,"disconnected":true}
info: πŸ”Œ Starting LensProxy
info: [LENS-PROXY]: Proxy server has started at http://localhost:59462
info: πŸ”Ž Testing LensProxy connection ...
info: ⚑ LensProxy connection OK
info: πŸ–₯️  Starting WindowManager
info: 🧩 Initializing extensions
info: [EXTENSION-DISCOVERY] loading extensions from C:\Users\jackf\AppData\Roaming\Lens
info: [CLUSTER]: "default" init success {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","context":"default","apiUrl":"https://192.168.178.79:6443"}
info: [EXTENSION-INSTALLER] installing dependencies at C:\Users\jackf\AppData\Roaming\Lens
info: [WINDOW-MANAGER]:Β Loading Main window from url: http://localhost:59462 ...
info: [EXTENSION-INSTALLER] dependencies installed at C:\Users\jackf\AppData\Roaming\Lens
info: [EXTENSION-DISCOVERY] watching extension add/remove in C:\Users\jackf\.k8slens\extensions
info: [EXTENSION]: enabled lens-license@0.1.0
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\extension-store\lens-survey\preferences-store.json
info: [EXTENSION]: enabled lens-survey@0.1.0
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\extension-store\lens-telemetry\preferences-store.json
info: [EXTENSION]: enabled lens-telemetry@0.1.0
info: [STORE]: SAVING C:\Users\jackf\AppData\Roaming\Lens\lens-extensions.json
info: [WINDOW-MANAGER]: Main window loaded
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-cluster-store.json
info: πŸ“‘ Checking for app updates
info: Checking for update
info: [CLUSTER]: activate {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":false,"online":false,"accessible":false,"disconnected":true}
info: [CLUSTER]: bind events {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":false,"online":false,"accessible":false,"disconnected":true}
info: [CLUSTER]: reconnect {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":false,"online":false,"accessible":false,"disconnected":true}
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-extensions.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-filesystem-provisioner-store.json
info: [CLUSTER-STORE] requesting initial state sync
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-workspace-store.json
info: [WORKSPACE-STORE] requesting initial state sync
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-user-store.json
info: [CLUSTER-STORE] start to listen (1)
info: [WORKSPACE-STORE] starting to listen state events
info: [EXTENSION]: enabled kube-object-event-status@0.1.0
info: [EXTENSION]: enabled lens-metrics-cluster-feature@0.1.0
info: [EXTENSION]: enabled lens-node-menu@0.1.0
info: [EXTENSION]: enabled lens-pod-menu@0.1.0
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\extension-store\lens-survey\preferences-store.json
info: [EXTENSION]: enabled lens-survey@0.1.0
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\extension-store\lens-telemetry\preferences-store.json
info: [EXTENSION]: enabled lens-telemetry@0.1.0
info: [EXTENSION]: enabled @nevalla/kube-resource-map@0.2.0
info: [PROTOCOL ROUTER]: internal registering /preferences
info: [PROTOCOL ROUTER]: internal registering /
info: [PROTOCOL ROUTER]: internal registering /landing
info: [PROTOCOL ROUTER]: internal registering /landing/:workspaceId
info: [PROTOCOL ROUTER]: internal registering /cluster
info: [PROTOCOL ROUTER]: internal registering /cluster/:clusterId
info: [PROTOCOL ROUTER]: internal registering /cluster/:clusterId/settings
info: [PROTOCOL ROUTER]: internal registering /extensions
info: [PROTOCOL ROUTER]: internal registering /extensions/install/:LENS_INTERNAL_EXTENSION_PUBLISHER_MATCH(@[A-Za-z0-9_]+)?/:LENS_INTERNAL_EXTENSION_NAME_MATCH
info: [LENS-VIEW]: init dashboard, clusterId=79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f
info: [LENS-VIEW]: waiting cluster to be ready, clusterId=79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f
error: Can't find working API for the Kubernetes resource ingresses
info: [KUBE-AUTH]: out-channel "kube-auth:79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f" {"data":"Authentication proxy started\n","meta":{"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":false,"online":false,"accessible":false,"disconnected":true}}
info: [LENS-VIEW]: loaded from http://79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f.localhost:59462/
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-cluster-store.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-extensions.json
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-filesystem-provisioner-store.json
info: [CLUSTER-STORE] requesting initial state sync
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-workspace-store.json
info: [WORKSPACE-STORE] requesting initial state sync
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\lens-user-store.json
info: [CLUSTER-STORE] start to listen (5)
info: [WORKSPACE-STORE] starting to listen state events
info: [APP]: Init dashboard, clusterId=79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f, frameId=5
info: Downloading kubectl 1.21.1+k3s1 from https://storage.googleapis.com/kubernetes-release/release/v1.21.1+k3s1/bin/windows/amd64/kubectl.exe to C:\Users\jackf\AppData\Roaming\Lens\binaries\kubectl\1.21.1+k3s1\kubectl.exe
info: [EXTENSION]: enabled kube-object-event-status@0.1.0
error: getaddrinfo ENOENT storage.googleapis.com {"errno":"ENOENT","code":"ENOENT","syscall":"getaddrinfo","hostname":"storage.googleapis.com"}
error: getaddrinfo ENOENT storage.googleapis.com {"errno":"ENOENT","code":"ENOENT","syscall":"getaddrinfo","hostname":"storage.googleapis.com"}
info: [EXTENSION]: enabled lens-metrics-cluster-feature@0.1.0
info: [EXTENSION]: enabled lens-node-menu@0.1.0
info: [EXTENSION]: enabled lens-pod-menu@0.1.0
info: [EXTENSION]: enabled lens-survey@0.1.0
info: [STORE]: LOADED from C:\Users\jackf\AppData\Roaming\Lens\extension-store\lens-telemetry\preferences-store.json
info: [EXTENSION]: enabled lens-telemetry@0.1.0
info: [EXTENSION]: enabled @nevalla/kube-resource-map@0.2.0
info: Update for version 4.2.4 is not available (latest version: 4.2.4, downgrade is disallowed).
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
info: [STORE]: SAVING C:\Users\jackf\AppData\Roaming\Lens\lens-cluster-store.json
info: [IPC]: undefined: /cluster/79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f/settings {"currentLocation":"http://localhost:59462/cluster/79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f"}
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
info: [CLUSTER]: refreshMetadata {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
info: [STORE]: SAVING C:\Users\jackf\AppData\Roaming\Lens\lens-cluster-store.json
info: [FEATURE]: render templates from C:\Program Files\Lens\resources\extensions\metrics-cluster-feature\resources\
info: Downloading kubectl 1.21.1+k3s1 from https://storage.googleapis.com/kubernetes-release/release/v1.21.1+k3s1/bin/windows/amd64/kubectl.exe to C:\Users\jackf\AppData\Roaming\Lens\binaries\kubectl\1.21.1+k3s1\kubectl.exe
error: getaddrinfo ENOENT storage.googleapis.com {"errno":"ENOENT","code":"ENOENT","syscall":"getaddrinfo","hostname":"storage.googleapis.com"}
error: getaddrinfo ENOENT storage.googleapis.com {"errno":"ENOENT","code":"ENOENT","syscall":"getaddrinfo","hostname":"storage.googleapis.com"}
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
info: [CLUSTER]: refresh {"id":"79f4f212-f8ad-4c0b-a0ae-7de06c4eb25f","name":"default","initialized":true,"ready":true,"online":true,"accessible":true,"disconnected":false}
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found
warn: PrometheusLens: failed to list services: services "prometheus-server" not found

Kubeconfig: Quite often the problems are caused by malformed kubeconfig which the application tries to load. Please share your kubeconfig, remember to remove any secret and sensitive information.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: ~~XXX~~
    server: https://192.168.178.79:6443
  name: default
- cluster:
    certificate-authority-data: ~~XXX~~
    server: https://kubernetes.docker.internal:6443
  name: docker-desktop
contexts:
- context:
    cluster: default
    user: default
  name: default
- context:
    cluster: docker-desktop
    user: docker-desktop
  name: docker-desktop
current-context: default
kind: Config
preferences: {}
users:
- name: default
  user:
    client-certificate-data: ~~XXX~~
    client-key-data: ~~XXX~~
- name: docker-desktop
  user:
    client-certificate-data: ~~XXX~~
    client-key-data: ~~XXX~~

Additional context Issue also occures when running as administrator

nebula2 commented 3 years ago

Seems like there are two main issues here.

  1. My DNS is blocking storage.googleapis.com
    • solved that
      1. after resolving the DNS issue it still did not work because there is no fitting kubectl.exe in the archives.
    • this solved it for me