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

[FEATURE] host.docker.internal resolving the same way as host.k3d.internal #884

Closed
dsbenghe opened this issue Dec 8, 2021 · 3 comments · Fixed by #938
Closed

[FEATURE] host.docker.internal resolving the same way as host.k3d.internal #884

dsbenghe opened this issue Dec 8, 2021 · 3 comments · Fixed by #938
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@dsbenghe
Copy link

dsbenghe commented Dec 8, 2021

Is your feature request related to a problem or a Pull Request

#101

Scope of your request

In the PR linked above it was discussed the lack of DNS name to access the host services. host.k3d.internal was introduced to point to the IP address host.docker.internal points to.

The introduction of another DNS name in addition to the well-known host.docker.internal makes the code not be that nice as it is explicitly pointing to a k3d specific DNS name. For example, kind as an alternative to k3d, provides automatic resolving of host.docker.internal similar with host.k3d.internal which sounds like a sensible solution to me as k3d runs on top of docker.

Describe the solution you'd like

Auto-configure host.docker.internal to resolve the same as the existing host.k3d.internal.

Describe alternatives you've considered

  • Change all the references in the code from host.docker.internal to host.k3d.internal and spread the knowledge in the team.
  • Some CoreDNS configuration
  • This may work too - [FEATURE] extra_hosts or hostAliases in k3d config #813 - If I understand correctly what this ones wants to achieve.
  • others?

If there is some other reasonable solution I'm happy to try it out.

@dsbenghe dsbenghe added the enhancement New feature or request label Dec 8, 2021
@iwilltry42 iwilltry42 self-assigned this Dec 11, 2021
@iwilltry42
Copy link
Member

Hi @dsbenghe , thanks for opening this issue!
host.docker.internal is still present everywhere where Docker injects it (i.e. in the k3d nodes which are docker containers).
host.docker.internal does not exist on every system (e.g. not on Linux) or just doesn't work everywhere (e.g. in WSL2).
That's why we have host.k3d.internal which is different per system and configuration.

I'm not sure how it works for you in the kind setup, as kind does not inject it into CoreDNS by default (see results https://github.com/kubernetes-sigs/kind/search?q=host.docker.internal).
However, it could be used due to the default forward . /etc/resolv.conf in CoreDNS, which we also have in k3d.

Alternatives I could think of:

@iwilltry42 iwilltry42 added this to the v5.3.0 milestone Dec 11, 2021
@dsbenghe
Copy link
Author

I havent looked at the details of how it works in kind. But it works. On an environment consisting of Docker Desktop on Windows (wsl2 or Hyper-V), the host.docker.internal resolves from pods and of course nodes too (while we don't care that much if it solves from the nodes; and like you said the node being docker container it works).

Trying to move from kind to k3d and this is the only thing not simple to solve.

@dsbenghe
Copy link
Author

dsbenghe commented Dec 16, 2021

But yes, #813 sounds like the general approach which will solve also this issue.

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

Successfully merging a pull request may close this issue.

2 participants