lensapp / lens

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

Can't reconnect to my OpenShift cluster #139

Open Riduidel opened 4 years ago

Riduidel commented 4 years ago

Describe the bug I use Lens on an OpenShift cluster. When I disconnect/reconnect from the cluster using the command line, Lens is no more able to connect to the cluster

Expected behavior I should be able to connect to my cluster each time with Lens

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:

 ←[32minfo←[39m: Checking for update
←[32minfo←[39m: Update for version 3.0.1 is not available (latest version: 3.0.1, downgrade is disallowed).
←[32minfo←[39m: initializing server for 127.0.0.1:49152 on port 49153
←[31merror←[39m: Failed to connect to cluster adeo-spc-turbine-qa/manawa-euw3-gcp1-adeo-cloud:443/20008203: {"name":"StatusCodeError","statusCode":401,"message":"401 - {\"kind\":\"Status\",\"apiVersion\":\"v1\",\"metadata\":{},\"status\":\"Failure\",\"message\":\"Unauthorized\",\"reason\":\"Unauthorized\",\"code\":401}","error":{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401},"options":{"json":true,"timeout":10000,"headers":{"host":"35d4d4ff-0f66-4a4d-a831-1ce61c5ef34b.localhost:49152"},"uri":"http://127.0.0.1:49152/api-kube/version","simple":true,"resolveWithFullResponse":false,"transform2xxOnly":false},"response":{"statusCode":401,"body":{"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401},"headers":{"audit-id":"ebe0900d-eb02-4cd7-a69f-36e0cd1b7b3c","cache-control":"no-store","content-length":"129","content-type":"application/json","date":"Thu, 19 Mar 2020 09:25:36 GMT","connection":"close"},"request":{"uri":{"protocol":"http:","slashes":true,"auth":null,"host":"127.0.0.1:49152","port":"49152","hostname":"127.0.0.1","hash":null,"search":null,"query":null,"pathname":"/api-kube/version","path":"/api-kube/version","href":"http://127.0.0.1:49152/api-kube/version"},"method":"GET","headers":{"host":"35d4d4ff-0f66-4a4d-a831-1ce61c5ef34b.localhost:49152","accept":"application/json"}}}}

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:
    server: https://MY_COMPANY_CLUSTER:443
  name: MY_COMPANY_CLUSTER:443
contexts:
- context:
    cluster: MY_COMPANY_CLUSTER:443
    namespace: MY_NAMESPACE
    user: MY_LOGIN/MY_COMPANY_CLUSTER:443
  name: MY_NAMESPACE/MY_COMPANY_CLUSTER:443/MY_LOGIN
current-context: MY_NAMESPACE/MY_COMPANY_CLUSTER:443/MY_LOGIN
kind: Config
preferences: {}
users:
- name: MY_LOGIN/MY_COMPANY_CLUSTER:443
  user:
    token: a token which changes everytime I reissue a oc login command

Additional context This is an enterprise OpenShift cluster, which uses authenticated access (in other words, to connect to that cluster, I ahve to run oc login first). Maybe it's due to the lack of OpenShift support in Lens (which I understand).

kambui commented 4 years ago

Ran into same issue . When connecting to Openshift .

Nokel81 commented 3 years ago

Is it possible to use the exec: command: structure within kubeconfig to run oc login for you?

Nokel81 commented 3 years ago

Might be related to #200, I assume this is still a problem with 4.1.4?