Skip to content

Cannot resolve Pod endpoint with selectorless service and custom Endpoints #3913

@Revolution1

Description

@Revolution1

Describe the bug
I'm trying to reuse a NLB for multiple backends with the same targetPort

Here is the subsets:
image

the controller prints this error

{"level":"info","ts":"2024-10-28T14:34:35Z","msg":"the pod in endpoint is not found in pod cache yet, will keep retrying","podKey":"lb4/pod1-6545f5f746-tccvn"}
{"level":"info","ts":"2024-10-28T14:34:35Z","msg":"Requeue for potentially ready endpoints","tgb":{"name":"k8s-lb4-mux-b239dd8c8d","namespace":"lb4"}}
{"level":"info","ts":"2024-10-28T14:34:37Z","msg":"the pod in endpoint is not found in pod cache yet, will keep retrying","podKey":"lb4/pod2-6c5c748d49-m25sb"}
{"level":"info","ts":"2024-10-28T14:34:37Z","msg":"Requeue for potentially ready endpoints","tgb":{"name":"k8s-lb4-mux-89437c4588","namespace":"lb4"}}

Steps to reproduce

  1. create a service with:
  • no selector
  • 2 ports with different name and no target port
  1. create Endpoints with 2 subsets pointing to 2 different pods in a different namespace from the service
apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
    service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
  name: mux
  namespace: multiplexer
spec:
  loadBalancerClass: service.k8s.aws/nlb
  ports:
  - name: 1dcf5c8
    nodePort: 31718
    port: 31040
  - name: d90d676
    nodePort: 32450
    port: 31815
  type: LoadBalancer
---
apiVersion: v1
kind: Endpoints
metadata:
  name: mux
  namespace: multiplexer
subsets:
- addresses:
  - ip: 10.0.6.192
    nodeName: ip-10-0-5-150.us-west-2.compute.internal
    targetRef:
      kind: Pod
      name: pod1-6545f5f746-tccvn
      namespace: default
      uid: c273178d-3c6e-45b4-b410-3927d137e780
  ports:
  - name: d90d676
    port: 80
    protocol: TCP
- addresses:
  - ip: 10.0.6.121
    nodeName: ip-10-0-5-150.us-west-2.compute.internal
    targetRef:
      kind: Pod
      name: pod2-6c5c748d49-m25sb
      namespace: default
      uid: 5ba62e6f-4b3f-4520-94bb-8dca662483c7
  ports:
  - name: 1dcf5c8
    port: 80
    protocol: TCP

Expected outcome
It's expected that the controller will create

  1. an NLB with 2 listeners: 31040 and 31815
  2. 2 target groups
  3. 1 target in each target group pointing to pod1 and pod2

Environment

  • AWS Load Balancer controller version: v2.9.2
  • Kubernetes version: 1.29.8
  • Using EKS (yes), version: 1.29

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions