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

Support listening on K2D_ADVERTISE_ADDR #85

Closed
barrydevp opened this issue Nov 7, 2023 · 4 comments · Fixed by #92
Closed

Support listening on K2D_ADVERTISE_ADDR #85

barrydevp opened this issue Nov 7, 2023 · 4 comments · Fixed by #92
Milestone

Comments

@barrydevp
Copy link

barrydevp commented Nov 7, 2023

According to a segment of code below
https://github.com/portainer/k2d/blob/6b185b025f04d78ca8b874ee95d2cddb10b989d3/cmd/k2d.go#L189C1-L193C13

and this issue on go official golang/go#5197
The k2d container always listen on [:::6443] and all interfaces will be listening when running on docker network=host mode.
I desire to use k2d on a LAN network for the educational purpose, so I need to public the k2d only on the LAN interface when using docker network=host mode. There is a work around available now by running on network=bridge mode and then publish the container port to the host network.

@deviantony
Copy link
Member

Yeah we have to clarify the docs I think. The host network is only required for k2d to automatically guess the IP of the host in case you are running on a host with a single network interface.

We might actually drop that dependency on the host network and make the K2D_ADVERTISE_ADDR a mandatory parameter. However, I would also like to find a smarter way to retrieve this.

Currently the K2D_ADVERTISE_ADDR is used to generate the TLS certificates associated with the API server.

If I understand correctly @barrydevp you would like to expose k2d over K2D_ADVERTISE_ADDR:PORT instead of :6443 ? Do you want to prevent access to k2d from other networks your machine is running into?

@barrydevp
Copy link
Author

Yes, you are fully correct. In this case I only want k2d to publish on advertise_addr:6443 to prevent traffic from another interfaces without using firewall.

@deviantony
Copy link
Member

That sounds legit to me and tbf that should have been the original behavior - probably an oversight.

@ncresswell
Copy link
Member

@deviantony feel free to add this to 1.0.1 release queue.

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

Successfully merging a pull request may close this issue.

3 participants