headlamp-k8s / headlamp

A Kubernetes web UI that is fully-featured, user-friendly and extensible
https://headlamp.dev
Apache License 2.0
2.22k stars 156 forks source link

[Windows] Unable to connect to clusters using kubeconfig #389

Closed yanrez closed 2 years ago

yanrez commented 2 years ago

Description

When I pick cluster on headlamp startup, I'm getting error: Failed to get authentication information: Bad Gateway If I use kubectl manually, it is able to connect.

Impact

Can't use headlamp since it can't connect to my clusters

Environment and steps to reproduce

Headlamp: 0.6.0.0 OS: Windows 11

  1. I launch headlamp C:\Users\yanrez\AppData\Local\Programs\headlamp\Headlamp.exe see censored stdout below
  2. Pick cluster
  3. Get error 'Failed to get authentication information: Bad Gateway'

Expected behavior

Able to connect and load UI

Additional information

❯ 13:48:30.614 > App starting... 13:48:31.359 > server process stderr: 2022/01/12 13:48:31 plugins-dir: C:\Users\yanrez\AppData\Roaming/Headlamp/plugins

13:48:31.364 > server process stdout: Headlamp Server API Routers:

13:48:31.364 > server process stdout: localhost:4466/clusters/miniaks/{api...} -> https://.hcp.eastus.azmk8s.io:443 localhost:4466/clusters/kind-kind-linux-cluster/{api...} -> https://127.0.0.1:61042 localhost:4466/clusters/x055-admin/{api...} -> https://.hcp.northcentralus.azmk8s.io:443 localhost:4466/clusters/x057-admin/{api...} -> https://.hcp.northcentralus.azmk8s.io:443

13:48:31.365 > server process stdout: localhost:4466/clusters/docker-desktop/{api...} -> https://kubernetes.docker.internal:6443 localhost:4466/clusters/kind-kind/{api...} -> https://127.0.0.1:55972

13:48:31.367 > server process stderr: 2022/01/12 13:48:31 listen tcp :4466: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

13:48:31.373 > server process process exited with code:1 signal:null

yanrez commented 2 years ago

If i manually downgrade to 0.5.2 everything works fine. When downgrading, I had to also kill server.exe (v0.6.0) manually - it was running in background and prevented older UI from working

illume commented 2 years ago

Hi @yanrez

Thanks for the info!

In 0.6.0 we tried to handle Kubernetes removing and deprecating some URLs. Seems like it's probably related to that. I wonder what distributions and versions of k8s you are using (kubectl version)?

It is supposed to kill the server process on app exit, so that seems like something we need to fix too.

yanrez commented 2 years ago

❯ kubectl version Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.5", GitCommit:"aea7bbadd2fc0cd689de94a54e5b7b758869d691", GitTreeState:"clean", BuildDate:"2021-09-15T21:10:45Z", GoVersion:"go1.16.8", Compiler:"gc", Platform:"windows/amd64"} Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"802eff1fe87ad2dd737ebbe891f30500b88beb00", GitTreeState:"clean", BuildDate:"2021-11-15T08:35:41Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"linux/amd64"}

illume commented 2 years ago

Thanks.

I wonder if there are any errors in the developer console?

ctrl+i (or view->Toggle Developer Tools) -> console tab

yanrez commented 2 years ago

That's odd. I've upgraded to 0.6.0 again, and everything works fine. I've killed server.exe manually to make sure I get latest version when launching headlamp 0.6.0, and it still works. I lost repro :(

illume commented 2 years ago

Oh! At least it works for you now :)

I wonder if the 0.5.2 server process was hanging around and the 0.6.0 app tried to talk to it.

yanrez commented 2 years ago

Maybe. One way or another, killing server.exe on app exit would be good thing.

joaquimrocha commented 2 years ago

Since this seems to indeed have been related to a running (unkilled) version of the server and we've addressed it in #395 , I think we should close this one down.

gaalw commented 7 months ago

Please reopen the issue.

Steps to reproduce.

Running `brew update --auto-update`...
==> Auto-updated Homebrew!
Updated 5 taps (hashicorp/tap, weaveworks/tap, minio/stable, homebrew/core and homebrew/cask).
==> New Formulae
cotp                 git-split-diffs      hashicorp/tap/hcp    tartufo              whisperkit-cli       yo
==> New Casks
nperf                           posture-pal                     proton-mail                     steinberg-activation-manager

You have 79 outdated formulae and 3 outdated casks installed.

==> Downloading https://github.com/kinvolk/headlamp/releases/download/v0.23.0/Headlamp-0.23.0-mac-x64.dmg
==> Downloading from https://objects.githubusercontent.com/github-production-release-asset-2e65be/220546758/eb639fc6-b9ab-4da6-bb
########################################################################################################################## 100.0%
==> Installing Cask headlamp
==> Moving App 'Headlamp.app' to '/Applications/Headlamp.app'

Run Headlamp.

Screenshot 2024-03-20 at 08 02 06

The clusters from ~/.kube/config are loaded properly.

If I click on "Load kubeconfig" button:

Screenshot 2024-03-20 at 08 02 47 Screenshot 2024-03-20 at 08 03 04 Screenshot 2024-03-20 at 08 03 11

So the function of loading external kubeconfig is not working at all. No idea why.

illume commented 7 months ago

Thanks for the detailed report. I opened a new issue with your post in case someone misses it here. See #1831