<p>I am using eks 1.16. I have one service which has type Loadbalancer with internet-facing.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
  name: kafka-test-3-0-external
  labels:
    helm.sh/chart: kafka-0.21.5
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: kafka-broker
    app.kubernetes.io/name: kafka
    app.kubernetes.io/instance: kafka-test-3
    pod: &quot;kafka-test-3-0&quot;
spec:
  type: LoadBalancer
  ports:
    - name: external-broker
      port: 19092
      targetPort: 19092
      protocol: TCP
#
  selector:
    app.kubernetes.io/component: kafka-broker
    app.kubernetes.io/name: kafka
    app.kubernetes.io/instance: kafka-test-3
    statefulset.kubernetes.io/pod-name: &quot;kafka-test-3-0&quot;
</code></pre>
<p>I want to provide elastic-ip/static-ip to that external service.</p>
<p><strong>Problem:</strong>
With Loadbalancer type, when I delete the service it will delete loadbalancer.
When I install once again then it will create new load balancer with new ip.</p>
<p><strong>Usecase:</strong> If I will uninstall/delete that service still the IP must be same.</p>
<p>How can I provide elastic-ip/static-ip?</p>

<p>There is one annotation to provide elastic-ip for network-load-balancer</p>
<p><strong><code>service.beta.kubernetes.io/aws-load-balancer-eip-allocations: eipalloc-05666791973f6a240</code></strong></p>
<p>If you're using Amazon EKS 1.16 or later, you can assign Elastic IP addresses to the Network Load Balancer by adding the following annotation. Replace the  (including &lt;&gt;) with the Allocation IDs of your Elastic IP addresses. The number of Allocation IDs must match the number of subnets used for the load balancer.</p>
<p><strong>Note:</strong> You can not use this annotation for the <strong>internal load balancer</strong>.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  annotations:
    external-dns.alpha.kubernetes.io/hostname: &quot;kafka-test-3-1.kafka.internal&quot;
    external-dns.alpha.kubernetes.io/ttl: &quot;60&quot;
    service.beta.kubernetes.io/aws-load-balancer-backend-protocol: tcp
    service.beta.kubernetes.io/aws-load-balancer-type: nlb
    service.beta.kubernetes.io/aws-load-balancer-eip-allocations: eipalloc-022b9722973f6a222
  name: kafka-test-3-1-external
  labels:
    helm.sh/chart: kafka-0.21.5
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: kafka-broker
    app.kubernetes.io/name: kafka
    app.kubernetes.io/instance: kafka-test-3
    pod: &quot;kafka-test-3-1&quot;
spec:
  type: LoadBalancer
  ports:
    - name: external-broker
      port: 19092
      targetPort: 19092
      protocol: TCP
#
  selector:
    app.kubernetes.io/component: kafka-broker
    app.kubernetes.io/name: kafka
    app.kubernetes.io/instance: kafka-test-3
    statefulset.kubernetes.io/pod-name: &quot;kafka-test-3-1&quot;
</code></pre>
<p>It will always use elasticIp for that loadbalancer.</p>
<p>For more eks annotations.</p>
<p><a href="https://docs.aws.amazon.com/eks/latest/userguide/load-balancing.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/eks/latest/userguide/load-balancing.html</a></p>
