layer2 find elected node

328 views
Skip to first unread message

maryvofin

unread,
Dec 8, 2018, 4:35:42 PM12/8/18
to metallb-users
Hi,

i tried to use metallb on hetzner cloud with floating ips. It only works if i set the floating ip to the correct node. Is there a way to find the elected node or just elect all nodes?

kind regards,
Mark

David Anderson

unread,
Dec 8, 2018, 9:36:38 PM12/8/18
to mary...@gmail.com, metallb-users
If you use L2 mode with externalTrafficPolicy=Cluster, you can attach your floating IP to any node in the cluster, and it will route correctly.

If you're using externalTrafficPolicy=Local, you can only attach the IP to a node where the is at least 1 pod of the service, but any such node is fine. If you attach to a node that doesn't have pods, the traffic will be blackholed.

Currently, the only way to know which node is the leader from MetalLB's perspective is Prometheus metrics. The speakers export metrics for each service, and one of them (I forget the name, but look at /metrics on one of the speaker pods) tells you if that node is the leader for each service. You could use that and some extra logic of your own to rehome the floating IP automatically.

Now that we have different leaders for each service, it could make sense to add a "current leader node" annotation to each service so that other tools can look it up easily. If that sounds useful for your use case, could you file a bug on github? I can't promise I'll get to it soon (lots of refactorings I need to do before doing stuff like that), but it sounds like a useful feature to track.

- Dave


--
You received this message because you are subscribed to the Google Groups "metallb-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to metallb-user...@googlegroups.com.
To post to this group, send email to metall...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/metallb-users/a7b00591-b601-46cd-b20a-9a643e9446ae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

maryvofin

unread,
Dec 9, 2018, 4:44:06 AM12/9/18
to metallb-users
Hi,

reading the the "METALLB IN LAYER 2 MODE" part of the documentation only one node answers to arp requests (the elected node right?). Assuming that all nodes are in the same layer 2 domain this is the correct behaviour.
I've added the ip manually to all nodes (ip addr add x.x.x.x dev eth0) and tried it again. This time it worked as described. 

For now i will use a script which adds alls floating ip to all nodes. 

Thanks for your help.
- Mark

Pankaj Agarwal

unread,
May 20, 2021, 11:30:08 PM5/20/21
to metallb-users
Mark,

Why you needed to do "ip addr add x.x.x.x dev eth0" or is this something done by the daemonset ?

I am not seeing on any documentation to perform this manually and I am running into a strange issue on one of the cluster where IP assignment etc is working fine but i am not seeing any arp related information in log and the IP is never accessible.

thanks,

Pankaj
Reply all
Reply to author
Forward
0 new messages