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

[Enhancement] Expose Host IP to services inside the cluster #360

Merged
merged 6 commits into from
Oct 6, 2020

Conversation

iwilltry42
Copy link
Member

@iwilltry42 iwilltry42 commented Sep 29, 2020

References

Fixes #101
Fixes #350

To-Do

  • figure out the host's routable IP
    • on Linux
    • on Windows
    • on MacOS
  • add that IP to the nodes' /etc/hosts (host.k3d.internal)
  • add an entry to CoreDNS to make it available to the Pods
  • add config option to disable this behavior
  • Tests
    • Docker for Desktop on MacOS (thanks @bitjson)
    • DfD on Windows (Hyper-V)
    • DfD on Windows (WSL2)
    • "native" Docker on Linux (Ubuntu in this case)

Notes

  • currently, adding CoreDNS entries is done in quite a hacky shell command chain to avoid pulling in Kubernetes dependencies
  • currently those changes only happen upon cluster creation
    • we could add the same functionality to k3d cluster start to provide a way to refresh the entries, if the IP changed for whatever reason

@iwilltry42 iwilltry42 added the enhancement New feature or request label Sep 29, 2020
@iwilltry42 iwilltry42 added this to the 3.1.0 milestone Sep 29, 2020
@iwilltry42 iwilltry42 self-assigned this Sep 29, 2020
@blaggacao
Copy link

Maybe worth a look:

@iwilltry42
Copy link
Member Author

@iwilltry42 iwilltry42 modified the milestones: 3.1.0, 3.0.3 Oct 2, 2020
@iwilltry42 iwilltry42 marked this pull request as ready for review October 2, 2020 10:36
@bitjson
Copy link

bitjson commented Oct 4, 2020

Fantastic, thank you for this! I was able to replace my current workaround with a simple host.k3d.internal, and I can confirm it works as expected on macOS 🚀.

…n of the host.k3d.internal entry into /etc/hosts and CoreDNS
@iwilltry42 iwilltry42 modified the milestones: 3.0.3, 3.1.0 Oct 5, 2020
@iwilltry42 iwilltry42 merged commit 54b4123 into main Oct 6, 2020
@iwilltry42 iwilltry42 deleted the enhancement/host-ip branch October 6, 2020 10:26
rancherio-gh-m pushed a commit that referenced this pull request Oct 6, 2020
Merge: d420ccf c47f7b7
Author: Thorsten Klein <[email protected]>
Date:   Tue Oct 6 12:26:50 2020 +0200

    Merge pull request #360 from rancher/enhancement/host-ip

    [Enhancement] Expose Host IP to services inside the cluster
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 this pull request may close these issues.

[FEATURE] dns for host at host.k3d.local How to access services on host machine?
3 participants