The Problem
So recently I was trying to run some kubectl commands using WSL2 to my home K8S cluster and encountered some strange events. Everything had worked fine when using WSL but for some reason I could now only ping external devices to my laptop (Router, Switch, Printer etc).
My Configuration
So just for clarification I have my configuration set like this.
The worker and the nodes are all configured to route traffic correctly and can actively ping my host and resolve external domains.
The Investigation
After conducting some internet-based investigation, I found discovered I was not the only person seeing this, and an issue was already raised on GitHub under the Microsoft/WSL https://github.com/microsoft/WSL/issues/4288.
There are some great discussions around the subject on here, but for anyone who wants to know the resolution that worked for me, keep reading.
The Resolution
After trying a few different suggestions, the best resolution I have found is listed by jonaskuke.
Essentially, we needed to set Forwarding to be enabled across the two v-Switches. Using this command (with admin rights) based on my v-Switch names works.
Get-NetIPInterface | where {$_.InterfaceAlias -eq 'vEthernet (WSL)' -or $_.InterfaceAlias -eq 'vEthernet (K8s-Switch)'} | Set-NetIPInterface -Forwarding Enabled
There are some discussions around post reboot persistency as it appears the setting is discarded post reboot, which may be due to the WSL v-Switch taking a while to imitate. However, keep this command in a .ps1 file and all is good.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.