k3d-io / k3d

Little helper to run CNCF's k3s in Docker
https://k3d.io/
MIT License
5.4k stars 458 forks source link

[Enhancement] Allow networking between pods on k3d clusters on different physical machines #175

Open dlashua opened 4 years ago

dlashua commented 4 years ago

What did you do? Does K3D support having worker nodes running on separate servers?

I run k3d create on 192.168.0.104 (node1) I run k3d add-node --k3s https://192.168.0.104:6443 --k3s_token=mytoken on 192.168.0.105 (node2)

I can kubectl with no issue. pods are created on both nodes. I can exec "bash" on containers running on either node, no problem.

However, containers on node1 don't seem to have network connectivity to containers on node2, nor the other way around. I can manually pick apart the pieces and see it not working (exec bash and ping). But, it's easiest to see by creating a deployment/service/ingress and forcing the deployment to node1. Since traefik also runs on node1, I can get to the service without issue. When I force the deployment to node2, traefik can't get there.

What did you expect to happen? pods created on node1 have IPs like 10.42.0.x pods created on node2 have IPs like 10.42.1.x

when creating a busybox pod on node1 and attaching to a shell there, I cannot ping pods on node2. nor the other way around. I expected to be able to.

Which OS & Architecture? Linux x86 for both machines

Which version of k3d? v1.5.1

Which version of docker? 19.03.3

iwilltry42 commented 4 years ago

Just leaving some notes here:

iwilltry42 commented 3 years ago

Just getting back to this due to a mention in a different issue. I assume that port 8472/udp needs to be mapped for this to work with flannel vxlan, according to https://rancher.com/docs/k3s/latest/en/installation/installation-requirements/#networking ? :thinking:

dcharbonnier commented 10 months ago

Using tailscale may soleve this issue : https://docs.k3s.io/installation/network-options?_highlight=tailscale#integration-with-the-tailscale-vpn-provider-experimental