Search code examples
kubernetesamazon-ec2kubernetes-ingressamazon-elb

Static IP to LoadBalancer service using k8s on aws (Allocation IDs)


It says use service.beta.kubernetes.io/aws-load-balancer-eip-allocations' to assign AWS EIP to the newly created Network Load Balancer (https://github.com/kubernetes/kubernetes/pull/69263). But, how to obtain AWS Allocation IDs?
At unable to give static ip to nlb,

kind: Service
apiVersion: v1
metadata:
  name: ingress-nginx
  namespace: ingress-nginx
  labels:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
    service.beta.kubernetes.io/aws-load-balancer-eip-allocations: "eipalloc- 
    07e3afcd4b7b5d644,eipalloc-0d9cb0154be5ab55d,eipalloc-0e4e5ec3df81aa3ea"
    service.beta.kubernetes.io/aws-load-balancer-subnets: "subnet- 
    061f4a497621a7179,subnet-001c2e5df9cc93960"
spec:
  type: LoadBalancer
  selector:
    app.kubernetes.io/name: ingress-nginx
    app.kubernetes.io/part-of: ingress-nginx

How to get those eipalloc IDs?


Solution

  • I may be misunderstanding your question, but I think you would just create Elastic IP's in AWS and then get their Allocation Id's either in the console or by describing them via the awscli.

    AllocationId
    [Network Load Balancers] The allocation ID of the Elastic IP address for an internet-facing load balancer.
    
    Type: String
    
    Required: No
    

    enter image description here