-
Notifications
You must be signed in to change notification settings - Fork 903
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
Multiple services with same IP announced multiple times #558
Comments
See https://gist.github.com/praseodym/842ab37c6a716926ef0d8e87de1a1eaa for a simple reproducer. It might need to be ran several times to hit the bug. Relevant output:
|
https://github.com/metallb/metallb/blob/main/speaker/layer2_controller.go#L78 |
Probably, yes! :) But I think we should try to reproduce first, just in case :-) |
I can reproduce this bug. In L2 mode, the same IP might be shared by multiple services and announced from different node. Sharing IPs in L2 mode should be disabled before we can make sure only services with the same master node can share IPs. |
@liuyuan10 thanks for the confirmation! And don't hesitate to send any PRs ;) I'd prefer to fix the bug, if possible, or maybe document the work-around until the bug is fixed (although it seems quite ugly, IIUC). Hopefully what @champtar spotted is the cause (I don't see why not), and hashing based on the IP might give us the order we need (need to double check what that change can imply, hopefully just a new order that respects the shared IP, but haven't thought it through). Also, this bug seems to be present for years if @champtar theory is correct (2a75be5), I don't think we need to rush to disable it right away. We can try to fix it or document a workaround, IMHO. What do you think? |
We can simply use IP in the hashing instead of service name? It should work for traffic local services given they need to use the same set of pods to share IPs. For traffic cluster services, this doesn't work because only nodes running the pods are candidates. why can't we choose all active nodes as candidate for traffic cluster services? |
For Or am I missing something? |
I mean treat all active nodes as master selection candidates instead of just those with pod running. In this way traffic cluster services will have the same set of selection candidates and we can use node + IP to sort the candiates |
@liuyuan10 if all pods are down not having the Loadbalancer is not really an issue |
@rata I don't want to use the IP but use |
It's not about pods are down or not. It's about what are the list of candidates for master selection. Different services will have different candidates (because pods runs on different nodes) and you can't use IP or metallb.universe.tf/allow-shared-ip in the hash.
I don't think it works. If two services have the same |
Which pod do you refer to? speaker? app? I guess you mean as returned by Can you please elaborate a little bit, just to avoid misunderstandings? |
Yes, the usableNodes() filters the active nodes with service endpoints so only nodes with service pods running are master selection candidates. Am I getting it right? If so, then you can't use IP + node to do hash because different services has different set of usable nodes (pods run on different nodes). |
I'm not familiar with the code, but I think that is correct too (if both services use The |
This is what I mean: I haven't tested it and would like to get comments. |
fixed by #976 |
When using two services (TCP+UDP) with the
Local
traffic policy, the same shared IP and the same set of pods (as described in the documentation), MetalLB in Layer 2 mode will sometimes announce the LB IP from two different nodes.A workaround is setting
externalIPs
on one of the services to the shared virtual IP, and using MetalLB on just one of the services.This was previously reported in #530 (comment).
The text was updated successfully, but these errors were encountered: