'Create static domain address for Network Load Balancer in multizone EKS cluster

I'm fairly new to AWS EKS service, and I'm trying to deploy an UDP network load balancer. I've a EKS cluster inside a VPC with two subnets in two availabilty zones, and I want to have a fixed address assigned to the NLB. Currently, I have this in my service yaml:

apiVersion: v1
kind: Service
metadata:
  name: udpserver-service
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: "nlb"
    service.beta.kubernetes.io/aws-load-balancer-eip-allocations: "eipalloc-XXXXX,eipalloc-YYYYY"
spec:
  selector:
    app: udpserver
  type: LoadBalancer
  ports:
    - protocol: UDP
      port: 5002
      targetPort: 5002
  externalTrafficPolicy: Local

This is the closest case that I found in StackOverflow, but the accepted solution only works when you have just one availabilty zone, as each Elastic IP defined in the service.beta.kubernetes.io/aws-load-balancer-eip-allocations annotation is assigned to the subnet on a different availability zone.

So, with this approach, I have two static IP addresses pointing to the two different subnets in both availability zones, instead of one single domain name pointing to the "global" load balancer.

The problem however is the same: every time that I deploy the service, a new NLB is created, with a different domain name.

How could I make this load balancer DNS fixed? Am I missing/misunderstanding anything?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source