Skip to content

Allow nodes/peers behind NAT to communicate directly (NAT to NAT) #109

@stv0g

Description

@stv0g

I am looking into a scenario having multiple cluster segment leaders behind NAT routers.

Usually a direct communication between these nodes is not possible as the local endpoint of these nodes gets mangled by NAT.

Jordan Whited has written a pretty nice writeup of a UDP hole punch technique for Wireguard to circumvent this issue:
https://www.jordanwhited.com/posts/wireguard-endpoint-discovery-nat-traversal/

His solution is both elegant and simple to implement.
Its based on the idea to use a public node as a registry which records the public facing endpoints of the NATed nodes an distributing them to all other nodes.

kilo has support for roaming of NATed nodes by recognising endpoint updates without overwriting them during the reconciliation phase (see #26, #34, mesh.updateNATEndpoints()).

I am proposing that we go a step further and also distribute these updated endpoints to other nodes in the cluster.
This could be done by letting kilo updating the kilo.squat.ai/force-endpoint annotation of these nodes.
This would replace the role of Jordan's CoreDNS plugin as we could use the Kubernetes API server.

However, I think it might be more elegant to introduce a new annotation kilo.squat.ai/endpoint to differentiate between a forced endpoint by the user and a dynamically recognized one by kilo.

What are your opinions on this proposal? I would give this a try if it is welcomed :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions