Pre-requisites

Add Helm Repository

Add the helm repository for NGINX Ingress Controller (https://kubernetes.github.io/ingress-nginx/)

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update

Create Values File

We will create a values file to override the Helm chart to customize the nginx ingress controller to our preference.

controller:
  config:
    use-proxy-protocol: "true"

  service:
    internal:
      enabled: true
      annotations:
        service.beta.kubernetes.io/aws-load-balancer-internal: "true"
        service.beta.kubernetes.io/aws-load-balancer-name: <internal-name>
        service.beta.kubernetes.io/aws-load-balancer-type: "external"
        service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "instance"
        service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
        service.beta.kubernetes.io/aws-load-balancer-scheme: internal
    annotations:
      service.beta.kubernetes.io/aws-load-balancer-name: <external name>
      service.beta.kubernetes.io/aws-load-balancer-type: "external"
      service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: "instance"
      service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
      service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing

In the above example, we will be creating 2 Network Load Balancers (NLB) with Proxy Protocol (https://docs.aws.amazon.com/elasticloadbalancing/latest/network/load-balancer-target-groups.html#proxy-protocol) enabled to allow proper forwarding of client IP addresses. Refer to AWS documentations for more information.

Install using Helm

Start the installation of NGINX ingress controller with the following command:

helm upgrade --install ingress-nginx ingress-nginx/ingress-nginx -f values.yaml --namespace ingress-nginx --create-namespace

Check NLB Status

Check the NLB addresses with the following command:

 kubectl get svc -n ingress-nginx