lensapp / lens

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

Connect to openshift cluster with OIDC #468

Open nadilas opened 4 years ago

nadilas commented 4 years ago

Describe the bug After installing v3.5.0 all I see in the application is: "Connecting ...", funnily the Online Status says: online

To Reproduce Steps to reproduce the behavior:

  1. Install v3.5.0 from scratch
  2. Add first cluster
  3. Open cluster
  4. See error

Expected behavior Cluster should load with the available namespace

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:

info: Update for version 3.5.0 is not available (latest version: 3.5.0, downgrade is disallowed).
error: Failed to connect to cluster namespace/cluster.address.com:443/user: 
{
   "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":"48af61ed-33c3-4e7c-a2f8-17be18b61dc9.localhost:58202"
      },
      "uri":"http://127.0.0.1:58202/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":{
         "cache-control":"no-store",
         "content-length":"129",
         "content-type":"application/json",
         "date":"Tue, 16 Jun 2020 10:52:48 GMT",
         "connection":"close"
      },
      "request":{
         "uri":{
            "protocol":"http:",
            "slashes":true,
            "auth":null,
            "host":"127.0.0.1:58202",
            "port":"58202",
            "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:58202/api-kube/version"
         },
         "method":"GET",
         "headers":{
            "host":"48af61ed-33c3-4e7c-a2f8-17be18b61dc9.localhost:58202",
            "accept":"application/json"
         }
      }
   }
}

Additional context As far as I can see there is nothing running on localhost:58202 , is Lens supposed to start a process to listen there? Or is it a prerequisite I missed?

nadilas commented 4 years ago

Any updates?

nevalla commented 4 years ago

@nadilas Please could you test 3.6.0-beta.1 which was released today. Is this still an issue there?

nadilas commented 4 years ago

Hey @nevalla, here's the output:

StatusCodeError: 401 - {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}

Also this little fellow shows up on startup:

error: Error: HttpError: 404 Not Found
"method: GET url: https://github.com/lensapp/lens/releases/download/v3.6.0-beta.2/latest.yml\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"
nevalla commented 4 years ago

Hey @nevalla, here's the output:

StatusCodeError: 401 - {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Unauthorized","reason":"Unauthorized","code":401}

The error indicates something is wrong with the access token?

Also this little fellow shows up on startup:

error: Error: HttpError: 404 Not Found
"method: GET url: https://github.com/lensapp/lens/releases/download/v3.6.0-beta.2/latest.yml\n\nPlease double check that your authentication token is correct. Due to security reasons actual status maybe not reported, but 404.\n"

This error seems to be some timing issue, because the new version was released just the same time you tried the. Did you aready try 3.6.0-rc.1? There was some fine-tuning made related to this issue.

nadilas commented 4 years ago

I’m logged in via the console just fine, both oc and kubectl are working alright. I am not using a token, I’m logging in usually via oc login

And yes I tried the 3.6.0-rc.1, I can reinstall tomorrow and give you feedback

Nokel81 commented 3 years ago

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

martafolf commented 2 years ago

This also seemingly is blocking my usage of Lens, any update since?

veyselsahin commented 2 weeks ago

a solution for someone who is still struggling

    - name: oidc
      user:
        exec:
            apiVersion: client.authentication.k8s.io/v1beta1
            args:
                - oidc-login
                - get-token
                - --oidc-issuer-url=https://your-oidc-url
                - --oidc-client-id=kubernetes
                - --grant-type=password
                - --username=YOUR_USERNAME
                - --password=YOUR_PASS
            command: /usr/local/bin/kubectl
            env: null
            interactiveMode: IfAvailable
            provideClusterInfo: false