Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable in WSL with networkingMode mirrored #4858

Open
aressler38 opened this issue Feb 6, 2025 · 0 comments
Open

Unstable in WSL with networkingMode mirrored #4858

aressler38 opened this issue Feb 6, 2025 · 0 comments

Comments

@aressler38
Copy link

aressler38 commented Feb 6, 2025

Summary

My default WSL configuration has the networkingMode=mirrored option as described in the documentation.
I was able to install microk8s in WSL by following the directions at https://microk8s.io/docs/install-wsl2 with networkingMode=mirrored.
After I updated a few settings, rebooted the WSL and my machine, I am no longer able to run microk8s. I tried purging everything with snap and apt, restarting, and doing another install of microk8s with the snap install command, but the install command would fail.

Upon inspection, journalctl -xe would print this line every time the install failed:
microk8s.daemon-containerd[ ]: containerd: failed to get listener for metrics endpoint: listen tcp 127.0.0.1:1338: bind: address already in use

Nothing is listening on 1338 on the host or the guest.

After some thinking, I tried switching my networking mode back to NAT, restarting WSL, and reinstalling microk8s. This worked. I was able to reinstall and run microk8s with networkingMode=NAT.

I tried going back to networkingMode=mirrored, but microk8s would hang forever at microk8s status --wait-ready.

What Should Happen Instead?

Microk8s should work with WSL's networkingMode=mirrored option.

If there is some technical incompatibility, then the documentation for WSL should call out that it is unstable with this option because none of the error logging makes it obvious.

Reproduction Steps

  1. Windows 11 Pro version 10.0.26120
  2. WSL version 2.4.10.0, Kernel version: 5.15.167.4-1
  3. WSL Ubuntu 22.04.5 LTS
  4. Add a .wslconfig file at $HOME\.wslconfig with the following
[wsl2]
networkingMode=mirrored
#networkingMode=NAT
[experimental]
autoMemoryReclaim=gradual
  1. Install microk8s via snap install microk8s --classic.
  2. In powershell, stop wsl: wsl --shutdown
  3. Change the .wslconfig file to use NAT, run WSL and check microk8s status.
  4. Shutdown WSL from powershell, change the networking mode back to mirrored and try checking microk8s status again. It should hang. Purging microk8s from the system at this point will make it impossible to reinstall via snap because of the port binding error.

Introspection Report

When it is in the stuck state, this command doesn't finish. I see only this output:

Inspecting system
Inspecting Certificates
Inspecting services
  Service snap.microk8s.daemon-cluster-agent is running
 FAIL:  Service snap.microk8s.daemon-containerd is not running
For more details look at: sudo journalctl -u snap.microk8s.daemon-containerd
 FAIL:  Service snap.microk8s.daemon-kubelite is not running
For more details look at: sudo journalctl -u snap.microk8s.daemon-kubelite
  Service snap.microk8s.daemon-k8s-dqlite is running
  Service snap.microk8s.daemon-apiserver-kicker is running
  Copy service arguments to the final report tarball
Inspecting AppArmor configuration
Gathering system information
  Copy processes list to the final report tarball
  Copy disk usage information to the final report tarball
  Copy memory usage information to the final report tarball
  Copy server uptime to the final report tarball
  Copy openSSL information to the final report tarball
  Copy snap list to the final report tarball
  Copy VM name (or none) to the final report tarball
  Copy current linux distribution to the final report tarball
  Copy asnycio usage and limits to the final report tarball
  Copy inotify max_user_instances and max_user_watches to the final report tarball
  Copy network configuration to the final report tarball
Inspecting kubernetes cluster
  Inspect kubernetes cluster

Can you suggest a fix?

I'm guessing that WSL's mirrored networking mode is doing something right as the process attempts to bind to port 1338, and maybe that's causing a conflict. Maybe there's a different way to do this or a workaround when bind fails.

Are you interested in contributing with a fix?

Maybe if the implementation is clear enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant