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
How do I get Cilium to run on WSL2? #29302
Comments
I understand this might be related to ipv6, but what changed between 1.14.4 and 1.15.0-pre.2? Works fine with 1.14.4 but not with 1.15.0-pre.2 WSL2, kind cluster, with custom-compiled kernel with all the required modules according to: |
I believe |
tl;dr: a lot. These rules used to be installed/removed by a shell script with a bunch of @HummingMind I've put up #29311 that ignores only the specific EAFNOSUPPORT returned by the rule removal. Feel free to play around with this on your own. Are WSL2 kernels typically built with v6 disabled? In this case, you'll need to disable Cilium's v6 support. Otherwise, you'll just hit errors elsewhere. @networkop's suggestion above may also prove useful. Did you explicitly disable |
with WSL2's kernel a LOT of default settings are disabled, so just going by https://docs.cilium.io/en/latest/operations/system_requirements/ may not help. I can include a diff of non-default flags (1.15.0-pre.2 runs fine for me) that I've got enabled but that may include some of the stuff not needed by Cilium. |
I just checked the config-wsl file, and yes, this is not set. |
There is a new netwroking mode in WSL2 2.0.9, called mirrored mode (experimental), which adds IPv6 support to WSL2. I'll try it out, and if it doesn't work, I'll go back to figuring out what might be missing from the compiled kernel (such as CONFIG_IPV6_MULTIPLE_TABLES=y that was mentioned by @networkop). I am far from an expert on Linux and kernel compilation, but some IPv6 modules are enabled in the config, such as: CONFIG_IPV6=y (so I think it might actually be enabled) I wish you guys had official docs on compiling the WSL2 kernel, as it is a really popular dev environment for local kubernetes testing/development. 🙏🏻 |
I'll play around with a few things, but if I can't get it to work, I'll take you up on the offer. Thank you! |
WSL2 mirrored mode doesn't work with Docker yet. 🤣 Will try disabling IPv6 during the install, to see if that works. If it doesn't, I'll go back to messing with the WSL2 kernel. 😨 |
Looks like IPv6 is disabled by default anyway during the Cilium installation. I tried with --set ipv6.enabled=false flag just in case, but getting the same error. |
I set CONFIG_IPV6_SEG6_LWTUNNEL to CONFIG_IPV6_SEG6_LWTUNNEL=y , and the original error message is gone.
|
@HummingMind Thanks for reporting back! Would you be willing to contribute a small section to our documentation with your findings? Sounds like it would help out quite a few WSL2 users! |
I can certainly contribute. Not sure I am qualified though, as this was the first time that I ever had to compile a Linux kernel. 😆 How would I go about doing this? I am also a bit new to open source 😨 |
If you've made it through building your own kernel, you're officially qualified. 😉
Not a problem! We have exhaustive documentation on the contribution process, see https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#submitting-a-pull-request. Granted, most of these things don't apply if you're just making a documentation change. Essentially, working on the docs implies editing a text file. Very straightforward! Get yourself a copy of the cilium/cilium source code and run Now, I'm not sure what the scope of the docs should be here. We're not going to document the whole kernel build process, but maybe some general pointers would be nice. Note that we already document a set of minimal kernel configs needed for Cilium to function correctly. Maybe linking to https://wsl.dev/wslcilium could be useful to avoid documenting the whole process for now, at least until wsl2 gains better defaults or makes it easier to plug in custom kernels. |
+1 adding this to docs would really help including me @HummingMind . Or maybe you could just add it here in the form of comment and someone else will look at it and do the contribution |
Ok. I'll post the instruictions here in a bit. Someone else can submit them as a PR. |
works thanks 😊 |
Note: This was tested on the Ubuntu 22.04 (2204.3.49.0) WSL2 image from the Microsoft Store Note: I compiled Kernel version linux-msft-wsl-5.15.137.3 (from https://github.com/microsoft/WSL2-Linux-Kernel.git). So BIG TCP support will not be available for IPv6 and IPv4. Note: you need to have Git installed. I included it in the first step just in case, but it should already be there. Note: I also had to install the "bc" and "dwarves" packages, otherwise the compilation was erroring out. So make sure to include them. Note: you can use the sed command to automate the setting/updating process of the kernel configuration options. Can also use grep to check and confirm the settings. Otherwise, you can do this however you can/want. The information and the instructions were gathered from the following sources: https://learn.microsoft.com/en-us/community/content/wsl-user-msft-kernel-v6 https://docs.cilium.io/en/stable/operations/system_requirements/#linux-kernel (I actually followed the v1.15.0-rc.0 docs, but this link is more suitable for the future versions of Cilium) Steps followed (inside your WSL2 Ubuntu distro):
make the changes here to the kernel configuration options, save the file, and exit nano --- (see the code section with the exact kernel options at the end of this post). Once you run the make command below, you might be promted with a couple of additonal configuration questions to configure some additional kernel options. If you do, just hit enter for default choices or select whatever you might need if you know what you are doing.
In Windows, create the WSL configuration file at: %USERPROFILE%.wslconfig and add the following entry and save the file:
Then do:
You should be good to go after this. Start WSL2 again and install kind/k3d + Cilium. You can check the kernel inside WSL2 with:
The kernel configuration options for the config-wsl file: From the Cilium documentation, this is what is required (depending on what functioanlity you need):
PS: You should also follow the "Load the modules" instructions from https://wsl.dev/wslcilium/#load-the-modules
comment out the following lines, so they look like this:
save the file, then:
The very last command should show the running modules, something similar to: |
thanks going to follow and try this |
This is more informational that anything else, but you can see here the desired configuration vs the default values: This is for the options listed in https://docs.cilium.io/en/stable/operations/system_requirements/#linux-kernel There are 42 options (as of Cilium 1.15.0) that need to be enabled and configured (wtih the desired values above). Some were not set and commented out, some were missing, some just had Y instead of M (see the table for all the differences). I use "grep" to find these lines (and determine what is missing) and "sed" to change the values or add the missing lines. |
Looks like with version linux-msft-wsl-5.15.137.3 of the WSL2 kernel, Microsoft enabled the missing IPv6 features. Here is the line from the changelog:
So Cilium's documentation is now applicable to the latest WSL2 kernel. The modules you have listed in the docs are all that is needed (I did not have to change any additional ones). The only catch was that these lines:
had to be entered as:
You can close this issue. The docs don't really need to be updated (unless people want to follow the steps as I outlined them in my posts above). |
@HummingMind I did all those things but still when I do |
@sadath-12 If it doesn't, that means you are not pointing at the new kernel in your wsl config. Make sure that in Windows you create the
Then, once you do |
@HummingMind yes the solution was to do it as code .wslconfig instead creating txt document it worked but when I open the wsl2 now I get The operation timed out because a response was not received from the virtual machine or container. Error code: Wsl/Service/CreateInstance/CreateVm/HCS_E_CONNECTION_TIMEOUT Press any key to continue... on the net for many people it works by wsl --shutdown does not seem to work for me . later I referred to the issue microsoft/WSL#10196 if I try something with single slash or put them under strings I revert back to old kernel |
I did the configs from here and then for compiling and moving the kernel I referred https://wsl.dev/wslcilium/ and kept |
referring this microsoft/WSL#8793 (comment) I do also have it enabled -- |
Currently I think since I used different ways to compile them it might be corrupted ill try the compilation from fresh again and try |
I've also found that building the loadable modules works around a few quirks when Cilium tries to run
|
Yeah, I would try a clean clone of the WSL2 kernel repo. Also, I modified the last section of my original post to include the instructions on loading the modules, per @networkop recommendation (although he does it a bit differently). |
Now it worked easily for me . Thank you @HummingMind for making this thing possible . Really appreciate your every guide has been worth |
@sadath-12 glad to hear you got it working! 🍻 |
@HummingMind were you able t run tetragon by building images locally ? I can't seems there is a much bigger obstacle there for wsl2 users |
I have not tried it. |
Is there an existing issue for this?
What happened?
Cilium pods crashing the the following error message in version 1.15.0-pre.2:
level=fatal msg="failed to start: daemon creation failed: error while initializing daemon: failed while reinitializing datapath: removing ipv6 proxy routing rule: address family not supported by protocol" subsys=daemon
Version 1.14.4 works fine.
Cilium Version
1.15.0-pre.2
Kernel Version
linux-msft-wsl-5.15.133.1
Kubernetes Version
1.28.3
Sysdump
No response
Relevant log output
No response
Anything else?
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: