- Install AWS Load Balancer Controller: This controller is essential for managing AWS load balancers in a Kubernetes environment.
Step 1: Enable Proxy Protocol in NLB Target Group
Add the following annotation to your NLB Target Group to enable the Proxy Protocol:
This ensures that the NLB forwards the original client's IP address along with other connection information.
Step 2: Configure Nginx Ingress Controller
values.yaml file of the Nginx Ingress Controller with the following settings:
use-forwarded-headers: "true": This instructs Nginx to use the
X-Forwarded-*headers, which may contain the client's original IP address as forwarded by the NLB.
use-proxy-protocol: true: Configures the Nginx Ingress Controller to expect and handle the Proxy Protocol header, including the original client IP, from the NLB.
enable-real-ip: true: Activates the
real_ipmodule in Nginx, allowing it to replace the client IP address (which would appear as the NLB's IP) with the one specified in the