Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to give static ip to nlb

I have hard time getting this working with NLB using ingress controller : https://kubernetes.github.io/ingress-nginx/deploy/#network-load-balancer-nlb

Even subnets are not taking effect here , its not passing my configurations in the API that creates the 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
  ports:
  - name: http
    port: 80
    targetPort: http
  - name: https
    port: 443
    targetPort: https
like image 279
amit Avatar asked Oct 29 '25 17:10

amit


1 Answers

The number of eip allocations must match the number of subnets in the subnet annotation.

service.beta.kubernetes.io/aws-load-balancer-eip-allocations: eipalloc-xyz, eipalloc-zzz

service.beta.kubernetes.io/aws-load-balancer-subnets: subnet-xxxx, mySubnet

You have 3 allocations but only 2 subnets.

In addition, the annotation

service.beta.kubernetes.io/aws-load-balancer-scheme: "internet-facing" is missing.

By default this will use scheme "internal".

I assume since you are allocating elastic IP addresses that you might want "internet-facing".

Also, you are using annotations that are meant for "AWS Load Balancer Controller" but you are using an "AWS cloud provider load balancer controller"

The external value for aws-load-balancer-type is what causes the AWS Load Balancer Controller, rather than the AWS cloud provider load balancer controller, to create the Network Load Balancer. docs

You are using service.beta.kubernetes.io/aws-load-balancer-type: nlb which means that none of the links provided earlier in this answer pertain to your Load Balancer. nlb type is an "AWS cloud provider load balancer controller" not an "AWS Load Balancer Controller"

For "AWS cloud provider load balancer controller" all the docs reference is this.

like image 168
ComradeJoecool Avatar answered Oct 31 '25 08:10

ComradeJoecool



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!