Skip to content

CFP: Allow shared lb ipam ip on services selecting different pods #38766

Closed

Description

@mikemrm

Cilium Feature Proposal

Hello, while setting up a new kubernetes deployment on a vps provider which only provides a single public ip. I was hoping to use lb ipam to satisfy the LoadBalancer service ip allocation.

This worked flawlessly for the first service which referenced the ip pool. However when I attempted to share the ip with another service I continuously received the out_of_ips reason on the second service.

After digging into ServiceView.isCompatible it appears there is a limitation placed which disallows two services using the externalTrafficPolicy of Local to select a different set of pods.

The following comment was provided for the reason for that limitation:

If both services have a 'local' external traffic policy, then they must select the same set of pods.
If this were not the case, then we could end up in a situation directing traffic to a node which doesn't
have the pod running on it for one of the services.

This however doesn't allow a user who is aware of this routing limitation and handles such cases, to use the lb ipam provider.

In my case, I have two services deployed as kind: DaemonSet ensuring that both services exist on all nodes.

So I'm proposing either dropping this limitation or providing a way to bypass this check.
If this is something Cilium would be open to, I'm happy to give it a first stab once we settle on the proper path forward.

Greatly appreciate this project and look forward to contributing to it!

Activity

  1. added 2 commits that reference this issue on Apr 7, 2025
    68b5257
    e9b239e
  2. dylandreimerink commented on Apr 15, 2025

    @dylandreimerink
    Member

    So I'm proposing either dropping this limitation or providing a way to bypass this check.

    I would be better if we can actually assert that the two services have backends on the same set of nodes. This should be theoretically possible, but a bit challenging to implement in a efficient way. Just disabling the check is going to cause some insidious bugs for unsuspecting users.

    Thinking aloud on how to go about that.

    The naive approach would be to query all endpoints selected by both services (via its selector or endpointslice), taking the list of nodes and comparing them. This requires querying and watching the endpoints. The main question being, what do we do if at some point pods get rescheduled such that they no longer live on the same nodes. Just removing the allocation from one of the services will break it.

    In my case, I have two services deployed as kind: DaemonSet ensuring that both services exist on all nodes.

    I think this might be the only way to do it in a way where chances of disruption due to endpoint churn and the like is not an issue. What we could do is still resolve the backends for a service, but assert that all of them must be part of a DaemonSet. We do not check the actual list of nodes, but make the assumption that if both services only select deamonset pods, that the set of nodes is eventually consistent.

    We would also have to ensure the node selector and node affinity of all DaemonSets match.

    This should allow your use case, and provide more safeguards without making it to fragile. WDYT?

  3. mikemrm commented on Apr 27, 2025

    @mikemrm
    Author

    Sorry for the late response, I missed the notification.

    I think having a way to override the check with an annotation on the service would be the simplest and most versatile solution while still keeping default checks. This would allow users to opt-out of these guide rails with something like lbipam.cilium.io/sharing-permit-different-pods: 'true' on all services sharing the same key.

  4. added a commit that references this issue on Apr 28, 2025
    d892a5f
  5. dylandreimerink commented on Apr 28, 2025

    @dylandreimerink
    Member

    I think having a way to override the check with an annotation on the service would be the simplest and most versatile solution while still keeping default checks

    I am not discounting that solution outright. But just making an annotation to disable checks feels like the "easy way" out of the issue. At the core, you are doing the right thing, and the software isn't smart enough to recognize that. So why not make the software smarter instead of making a "i know better" annotation?

  6. mikemrm commented on Apr 29, 2025

    @mikemrm
    Author

    I agree, making the software smarter is probably better in the long run. I'm not currently familiar with kubernetes apis, so I'm unfamiliar with what would be necessary to achieve this.

    What would be a good next step for this?

  7. haraldkoch commented on Jul 2, 2025

    @haraldkoch

    I think I just discovered this limitation while migrating (working) Prometheus services from a Calico-based cluster, attempting to use "Sharing Keys" as described here: https://docs.cilium.io/en/latest/network/lb-ipam/#sharing-keys

    This works for Prometheus exporters because each one runs on a different service port. Does Cilium's traffic routing not take into account the ports declared in the service? If the ports are unique, then the [ip,port] tuple is also unique, and there should be no conflict.

    I note that the documentation for Sharing Keys does mention services with unique ports, and does not mention any ExternalTrafficPolicy: Local limitation:

    As long as the services do not have conflicting ports, they will be allocated the same IP.

  8. github-actions commented on Sep 1, 2025

    @github-actions

    This issue has been automatically marked as stale because it has not
    had recent activity. It will be closed if no further activity occurs.

  9. added
    staleThe stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
    on Sep 1, 2025
  10. github-actions commented on Sep 16, 2025

    @github-actions

    This issue has not seen any activity since it was marked stale.
    Closing.

  11. 12 remaining items

  12. added
    pinnedThese issues are not marked stale by our issue bot.
    and removed
    staleThe stale bot thinks this issue is old. Add "pinned" label to prevent this from becoming stale.
    on Mar 16, 2026
  13. added 3 commits that reference this issue on Jun 4, 2026
    6a0b83d
    4f6b7fc
    a02d618
  14. added a commit that references this issue on Jul 3, 2026
    1660b07
  15. added a commit that references this issue on Jul 17, 2026
    7519349
  16. added 4 commits that reference this issue on Sep 2, 2026
    177e70f
    efc2caa
    1e1ad2f
    d1c53f7
  17. added a commit that references this issue on Sep 10, 2026
    d3ed6db
  18. added a commit that references this issue on Sep 25, 2026
    091ec1b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature/lb-ipamkind/cfpCilium Feature Proposalkind/featureThis introduces new functionality.pinnedThese issues are not marked stale by our issue bot.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions