You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your Windows build number:
C:\Users\XXXX>ver
Microsoft Windows [版本 10.0.18922.1000]
What you're doing and what's happening:
[XXX@XXX ~]$ netstat
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:52742 localhost:x11 ESTABLISHED
tcp 0 0 localhost:52702 localhost:x11 ESTABLISHED
tcp 0 0 localhost:52784 localhost:x11 ESTABLISHED
tcp 0 0 localhost:52700 localhost:x11 ESTABLISHED
tcp 0 0 localhost:52780 localhost:x11 ESTABLISHED
[ed, KC... some snips]
What's wrong / what should be happening instead:
Host don't share loopback with WSL guest (At least now). Reserve DNS takes host's ip as localhost may be confusing
172.17.58.195 is the ip address of the guest. 172.17.58.193 is the ip address of the host.
The problem occurs on every program using reserve dns.
Reacted by Dominic, Simon Tunnat, Matt Rossman, Eric Pederson, Fujita Hitoshi, Roman Kornev, Ross Bender and Daniel Kmak
This one is fundamentally dupe #4106, but we need a landing zone for the request to share localhost in WSL2 à la WSL1. For the time being (if or until that changes) this is by-design.
As a rider, not only does WSL not share the IP address space, the address assigned to the container is not stable to the Distribution (like Forest Gump, you never know what IP address you're gonna get). This is exceedingly problematic for numerous common dev scenarios. It would be better if:
(a) The nonroutable (usually 192* or 172*) segment were shared, and the MAC address made stable, so the user's DHCP can serve up a stable IP address, or
(b) Let the address float, but serve up a stable DNS entry based on the Distro name, or
(c) Both
Note that the current practice of serving up the same Windows hostname (for me, DESKTOP-BNN97ME) on different addresses (as of this writing also by-design behavior) is also problematic because it brings down the whole ssh key exchange (and by extension git) edifice.
Reacted by Thomas, transtone, Karuboniru, coffenbacher, Davide Specchia, mjeffrey, Roan Martin-Hayden, Rémy, luxzg, Mike Rodriguez and 2 more
Note that the current practice of serving up the same Windows hostname (for me, DESKTOP-BNN97ME) on different addresses (as of this writing also by-design behavior) is also problematic because it brings down the whole ssh key exchange (and by extension git) edifice.
is also problematic because it brings down the whole ssh key exchange (and by extension git) edifice
Clarification because it was assumed obvious, and maybe wasn't. When I said "whole edifice" I am talking about sshd not ssh. For example, Github does not care whether a client address in WSL2 floats. On the other hand, if github.com's IP address changed all the time, and there was no way to DNS lookup github.com, well, that would be a problem.
the kubectl proxy command fails to forward traffic through to the Kubernetes dashboard. Running wsl --shutdown from a powershell terminal, then starting everything up again solves the issue.
Reacted by Marcin Nowrot, Shinebayar G, Vishal Kamat, akramosman, Ed43, Arthur Walsh and Codefox42
Same here, but with kubectl port-forward. Try restarting wsl with wsl --shutdown but it no longer fixes the issue. I can successfully curl the exposed port from wsl but opening a browser window in windows yields no response.
Reacted by yousafsyed-bg, nallenpx, semuserable and Aliaksandr Luferau
Once updated to build 2004, my wsl remote development experience has been a nightmare. I've been experiencing the issue on 3/3 different machines. SSH connection to the vm, through localhostdoes not work reliably. Every morning I have to go through a painstakingly reboot cycle until the vm is reachable again. That can take between 1 to 4 reboots, a big waste of time.
Interestingly, the VSCode remote development server is not affected by this issue, no idea why.
wsl --shutdown: doesn't do anything useful
fast startup disabled
"network reset": if useful, only lasts till the next reboot
fiddling with hosts file: no good either, redirection is handled by internal server anyway
As I said, I had the chance to do in depth test on three different pc, all of them showed the same behavior. Sometimes more often, sometimes less. This was the only setup that made cross platform development feasible to setup.
There still are a lot of ongoing issues, but they have all been closed some time in the past: #4208#5298#4636#4150
I'm aware Microsoft recommends WSL1 for cross development, due to filesystem performance issues. WSL1 is quite cool, tech wise, but it's not a vm, so there's no guarantee of everything behaving correctly. Like Unix domain sockets.
I got accessing localhost from Windows 2004 working through deinstalling Docker Desktop and its WSL2 integration. It worked for a few days.
Now it stopped working again. Also tried everything, from disabling fast startup to wsl --shutdown . It was such a happy world when it worked...
I changed the insider programme updates to the beta channel and now it's all working again. Not sure what update is messing with this. I'm on: Version 10.0.19042 Build 19042 if that helps anyone.
The problem seems to be the 2004 update. After that, remote development was completely unreliable for me. Unfortunately i can't roll back to 19042, since the update was more than 10 days ago. Bence Komarniczky (@niczky12) i just tried switching to the beta channel. It doesn't work for me though.
I found a solution, at least for the localhost accessability issue. To access localhost from a windows browser, you have to forward the wanted ports via a powershell script, as stated here: #4150 (comment)
To simplify even more this command can be wrapped into a simple bash script named /usr/bin/kubectl_wsl that can forward all the kubectl commands to the docker container.
Create the following bash script at /usr/bin/kubectl_wsl
#!/usr/bin/bash
kubectl version
docker run --rm --name kubectl --user root -v ~/.kube/config:/.kube/config -p 8080:8080 bitnami/kubectl:latest "$@"
For us installing chrome on wsl2 was a viable solution (but for this you need a running xserver / xserver setup).
Accessing the the http server (running wsl2) via localhost from linux-chrome is blazing fast.
The second solution was:
remove a line in %UserProfile%.wslconfig
On Windows 20H2 & Ubuntu 20.04 in WSL2, I just solved this issue with running kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000 and then to open it directly in Windows browser, I run command in second terminal wslview http://$(hostname -I):8888 - works really good without any other configuration.
Reacted by yousafsyed-bg, m-nyuki, Cees Bos, Stijn Hoskens, Evgenii Khandygo, Alberto, LEE JEONGWON, Marcus Powrie, shafackit, piouson and 4 more
Reacted by Matheus Ale, shafackit, Jeremy Morren and Oriol López Sánchez
Reacted by Matheus Ale, shafackit, Sami Sayegh, Jesús Andrés and Oriol López Sánchez
Open your browser and go to: http://localhost:8001/api/v1/namespaces/NAMESPACE/services/https:SERVICE:PORT/proxy/
Activity
[-][WSL2] reserve dns takes host as "localhost"[/-][+][WSL2] share localhost with Windows[/+]therealkenc commentedon Jun 20, 2019
This one is fundamentally dupe #4106, but we need a landing zone for the request to share localhost in WSL2 à la WSL1. For the time being (if or until that changes) this is by-design.
As a rider, not only does WSL not share the IP address space, the address assigned to the container is not stable to the Distribution (like Forest Gump, you never know what IP address you're gonna get). This is exceedingly problematic for numerous common dev scenarios. It would be better if:
(a) The nonroutable (usually
192*or172*) segment were shared, and the MAC address made stable, so the user's DHCP can serve up a stable IP address, or(b) Let the address float, but serve up a stable DNS entry based on the Distro name, or
(c) Both
Note that the current practice of serving up the same Windows
hostname(for me, DESKTOP-BNN97ME) on different addresses (as of this writing also by-design behavior) is also problematic because it brings down the wholesshkey exchange (and by extensiongit) edifice.transtone commentedon Jun 21, 2019
#4208
benhillis commentedon Jun 22, 2019
transtone (@transtone) - Makes sense. May be prudent to change the WSL2 hostname until (hypothetically) we can share IP address with the host.
therealkenc commentedon Jun 23, 2019
Clarification because it was assumed obvious, and maybe wasn't. When I said "whole edifice" I am talking about
sshdnotssh. For example, Github does not care whether a client address in WSL2 floats. On the other hand, ifgithub.com's IP address changed all the time, and there was no way to DNS lookupgithub.com, well, that would be a problem.scarolan commentedon Aug 3, 2020
Same issue here. I was following this WSL2 + Kubernetes tutorial:
https://kubernetes.io/blog/2020/05/21/wsl-docker-kubernetes-on-the-windows-desktop/
the
kubectl proxycommand fails to forward traffic through to the Kubernetes dashboard. Runningwsl --shutdownfrom a powershell terminal, then starting everything up again solves the issue.mmgeorge commentedon Sep 14, 2020
Having the same issue as Sean Carolan (@scarolan), things work if I shutdown wsl and then start it back up again.
niczky12 commentedon Dec 22, 2020
Same here, but with
kubectl port-forward. Try restarting wsl withwsl --shutdownbut it no longer fixes the issue. I can successfullycurlthe exposed port from wsl but opening a browser window in windows yields no response.Lucide commentedon Jan 9, 2021
Once updated to build 2004, my wsl remote development experience has been a nightmare. I've been experiencing the issue on 3/3 different machines. SSH connection to the vm, through
localhostdoes not work reliably. Every morning I have to go through a painstakingly reboot cycle until the vm is reachable again. That can take between 1 to 4 reboots, a big waste of time.Interestingly, the VSCode remote development server is not affected by this issue, no idea why.
wsl --shutdown: doesn't do anything usefulAs I said, I had the chance to do in depth test on three different pc, all of them showed the same behavior. Sometimes more often, sometimes less. This was the only setup that made cross platform development feasible to setup.
There still are a lot of ongoing issues, but they have all been closed some time in the past: #4208 #5298 #4636 #4150
I'm aware Microsoft recommends WSL1 for cross development, due to filesystem performance issues. WSL1 is quite cool, tech wise, but it's not a vm, so there's no guarantee of everything behaving correctly. Like Unix domain sockets.
95lux commentedon Jan 12, 2021
I got accessing localhost from Windows 2004 working through deinstalling Docker Desktop and its WSL2 integration. It worked for a few days.
Now it stopped working again. Also tried everything, from disabling fast startup to
wsl --shutdown. It was such a happy world when it worked...niczky12 commentedon Jan 13, 2021
I changed the insider programme updates to the beta channel and now it's all working again. Not sure what update is messing with this. I'm on: Version 10.0.19042 Build 19042 if that helps anyone.
95lux commentedon Jan 13, 2021
The problem seems to be the 2004 update. After that, remote development was completely unreliable for me. Unfortunately i can't roll back to 19042, since the update was more than 10 days ago.
Bence Komarniczky (@niczky12) i just tried switching to the beta channel. It doesn't work for me though.
niczky12 commentedon Jan 13, 2021
That is good to know. I'll pause my updates and consider myself lucky. Let's hope this gets resolved quickly.
95lux commentedon Jan 13, 2021
I found a solution, at least for the localhost accessability issue. To access localhost from a windows browser, you have to forward the wanted ports via a powershell script, as stated here:
#4150 (comment)
yousafsyed commentedon Jan 29, 2021
Since I haven't been able to find a simple solution of kubectl port-foward, I tricked wsl2 with a docker container inside of my distro.
docker run --rm --name kubectl --user root -v ~/.kube/config:/.kube/config -p 8080:8080 bitnami/kubectl:latest / port-forward --address 0.0.0.0 --namespace containerNameSpace containerName 8080:7111To simplify even more this command can be wrapped into a simple bash script named /usr/bin/kubectl_wsl that can forward all the kubectl commands to the docker container.
Create the following bash script at
/usr/bin/kubectl_wslnow we can simply run the command as
I hope this can help someone.
stephankoelle commentedon Feb 11, 2021
For us installing chrome on wsl2 was a viable solution (but for this you need a running xserver / xserver setup).
Accessing the the http server (running wsl2) via localhost from linux-chrome is blazing fast.
The second solution was:
remove a line in %UserProfile%.wslconfig
localhostForwarding=true
newcanopies commentedon Apr 22, 2021
same issue
maciejgwizdala commentedon Sep 22, 2021
On Windows 20H2 & Ubuntu 20.04 in WSL2, I just solved this issue with running
kubectl port-forward --address 0.0.0.0 pod/mypod 8888:5000and then to open it directly in Windows browser, I run command in second terminalwslview http://$(hostname -I):8888- works really good without any other configuration.guidsdo commentedon Oct 24, 2021
This worked for me:
kubectl proxyhttp://localhost:8001/api/v1/namespaces/NAMESPACE/services/https:SERVICE:PORT/proxy/Example:
http://localhost:8001/api/v1/namespaces/argocd/services/https:argocd-server:80/proxyMore info:
https://kubernetes.io/docs/tasks/administer-cluster/access-cluster-services/#manually-constructing-apiserver-proxy-urls