Kubernetes udp load balancing issue?

Asking for help? Comment out what you need so we can get more information to help you!

Cluster information:

Kubernetes version: v1.28.0

Im facing some issues related to k8s udp load balancing. i.e. We have one lb and 3 pods basically lb target’s to these pods.

  • In all 3 pods I’ve opened udp connection for 3 different udp ports using nc -ul port command.
  • Now I’m open 4th tab and send some data to specific udp pods using lb ip command: nc -ul 127.0.0.1 30002 also checked connection with udp port using command telnet 127.0.0.1 30002 and its working fine.
  • What I’m expecting is the udp packets/data in desired pod to which I’m sending packets/data using specific port. But I’m not getting any packets/data in any pod.

LB Yaml

apiVersion: v1
kind: Service
metadata:
  name: webinar-mediaserver
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
    service.beta.kubernetes.io/aws-load-balancer-access-log-enabled: 'true'
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
  labels:
    name: webinar-mediaserver
spec:
  type: LoadBalancer
  externalTrafficPolicy: Local
  sessionAffinity: None
  ports:
    - name: media2
      protocol: UDP
      port: 30002
      targetPort: 30002
    - name: media
      protocol: UDP
      port: 30000
      targetPort: 30000
    - name: media1
      protocol: TCP
      port: 4443
      targetPort: 4443
  selector:
    app: webinar-mediaserver
    type: prod

POD Yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: webinar-mediaserver
spec:
  selector:
    matchLabels:
      app: webinar-mediaserver
  replicas: 1
  template:
    metadata:
      labels:
        app: webinar-mediaserver
    spec:
      containers:
        - name: webinar-mediaserver
          image: webinar-mediaserver02
          ports:
            - containerPort: 80
            - containerPort: 30002
              protocol: UDP
            - containerPort: 30000
              protocol: UDP
          imagePullPolicy: Never
          resources:
            limits:
              memory: 1Gi
              cpu: '2'
            requests:
              memory: 128Mi
              cpu: '0.5'
          env:
            - name: SERVER_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: SERVER_HOST
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: SERVER_ID
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name

Hey
Can some one help me out for it?