kubectl proxy within ubuntu in WSL windows 10

10/16/2019

I´m running windows 10 with WSL1 and ubuntu as distrib. My windows version is Version 1903 (Build 18362.418)

I´m trying to connect to kubernetes using kubectl proxy within ubuntu WSL. I get a connection refused when trying to connect to the dashboard with my browser.

enter image description here

I have checked in windows with netstat -a to see active connections.

enter image description here

If i run kubectl within the windows terminal i have no problem to connect to kubernetes, so the problem is only happening when i try to connect with ubuntu WSL1.

I have also tried to run the following command

kubectl proxy --address='0.0.0.0' --port=8001 --accept-hosts='.*'

... but the connection is refused although i see that windows is listening to the port. Changing port to another port didn´t fix the proble. Disabling the firewall didnt´fix the problem as well.

Any idea ?

-- david
kubernetes
windows-subsystem-for-linux

1 Answer

10/21/2019

First thing to do would be to check if you able to safely talk to your cluster: (kubectl get svc -n kube-system, kubectl cluster-info)

If not check if $HOME/.kube folder was created. If not, run: gcloud container clusters get-credentials default --region=<your_region>

-- OhHiMark
Source: StackOverflow