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

Epic: Use Lima host resolver on Windows #1899

Closed
7 tasks done
jandubois opened this issue Mar 25, 2022 · 4 comments
Closed
7 tasks done

Epic: Use Lima host resolver on Windows #1899

jandubois opened this issue Mar 25, 2022 · 4 comments
Assignees
Labels
area/dns kind/documentation-ready Improvements or additions to documentation kind/enhancement New feature or request kind/epic Umbrella-bug for a group of related issues platform/windows
Milestone

Comments

@jandubois
Copy link
Member

jandubois commented Mar 25, 2022

We want to use the Lima host resolver to take advantage of all the DNS configuration on the host itself (automatic support of split-DNS over VPN etc).

The resolver code should be in a separate repo at https://github.com/rancher-sandbox/rancher-desktop-host-resolver. It currently uses a fork of pkg/hostagent/dns.go from Lima to allow rapid development. Once this task is complete, any changes should be back-ported upstream.

  • Add cobra commandline processing. Add options for the listening interface, the tcp and udp ports, IPv6 support, and built-in hostnames (like host.docker.internal).

  • Choose random available ports when tcp/udp ports are not specified.

    Look at the findXXXFreeLocalPort functions; we should be able to reuse them.

  • Add an option to specify allowed source addresses and reject connections not from allowed sources.

    For WSL2 we will need to connect via the host IP address, but we don't want to accept outside connections. Look at the pseudo loopback forwarder for a possible implementation (except that one checks destination, not source address).

NOTE: For the above item, a different approach was taken. To avoid filtration of the incoming DNS requests. The host-resolver runs two processes, 1) In wsl distro 2) on the windows host machine, the communication happens over a dedicated AF_VSOCK connection, therefore the process that runs on the windows host machine can only accept DNS lookups that are incoming over the AF_VSOCK connection.

  • Create Github action to make releases

  • Download host resolver in Rancher Desktop resources

  • Start/stop host resolver before/after the WSL2 distro is started

  • Replace dnsmasq with the host resolver.
    NOTE: for the item above, we are allowing the users to choose between host-resolver or dnsmaq through experimentalHostResolver configuration flag.

@jandubois jandubois added this to the Next milestone Mar 25, 2022
@jandubois jandubois added kind/epic Umbrella-bug for a group of related issues and removed kind/enhancement New feature or request labels Mar 25, 2022
@jandubois jandubois changed the title Use Lima host resolver on Windows Epic: Use Lima host resolver on Windows Mar 25, 2022
@gunamata gunamata added the kind/enhancement New feature or request label Apr 1, 2022
@Nino-K
Copy link
Member

Nino-K commented Apr 25, 2022

How to enable this feature:

This feature can be enabled through a configuration property experimentalHostResolver in %APPDATA%\rancher-desktop\settings.json. By default this property is set to false, meaning that the default DNS process in the rancher desktop will be handled through dnsmasq. However, if this property is set to true the default DNS lookup will switch to host-resolver.

NOTE: This feature can only be enabled for Windows currently and it is an experimental feature.

You can take a look at the example settings.json file below as a reference:

{
   "version":4,
   "kubernetes":{
      "version":"1.22.7",
      "memoryInGB":2,
      "numberCPUs":2,
      "port":6443,
      "containerEngine":"moby",
      "checkForExistingKimBuilder":false,
      "enabled":true,
      "WSLIntegrations":{
         "Ubuntu":true
      },
      "options":{
         "traefik":true,
         "flannel":true
      },
      "suppressSudo":false,
      "experimentalHostResolver":true           <== This is the config!
   },
   "portForwarding":{
      "includeKubernetesServices":false
   },
   "images":{
      "showAll":true,
      "namespace":"k8s.io"
   },
   "telemetry":true,
   "updater":false,
   "debug":false,
   "pathManagementStrategy":"notset"
}

After applying the configuration changes above you must restart Rancher Desktop for the changes to take place.

@Nino-K Nino-K added the kind/documentation-ready Improvements or additions to documentation label Apr 25, 2022
@Nino-K
Copy link
Member

Nino-K commented Apr 26, 2022

@jandubois
Copy link
Member Author

NOTE: This feature can only be enabled for Windows currently and it is an experimental feature.

It is already the default on Linux and macOS.

@CaringDev
Copy link

On Windows %APPDATA%\rancher-desktop\settings.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/dns kind/documentation-ready Improvements or additions to documentation kind/enhancement New feature or request kind/epic Umbrella-bug for a group of related issues platform/windows
Projects
None yet
Development

No branches or pull requests

4 participants