Setting Up NGINX Ingress Controller in EKS with HTTP and TCP Routing
In AWS EKS, exposing each application with its own LoadBalancer is costly and inefficient. A smarter approach is using an NGINX Ingress Controller, which allows routing multiple applications through a single LoadBalancer — using host-based HTTP routing and TCP port-based routing.
This guide explains how to:
- Deploy NGINX Ingress Controller via Helm
- Set up host-based routing for HTTP apps
- Configure TCP routing for non-HTTP services
- Map domains via Cloudflare
- Reference official docs
#
Why Use Ingress in EKS?
Benefits |
---|
One LoadBalancer for many services |
Lower costs |
Host & path-based routing |
Supports TCP & HTTP apps |
Works with Cloudflare |
Centralized config |
#
Prerequisites- EKS Cluster
- Helm, kubectl, eksctl
- Cloudflare account
- Domain for your app
- Applications/services already deployed in Kubernetes
#
Step 1: Install NGINX Ingress Controller via Helm
For advanced configurations, refer to the official NGINX Ingress Helm chart documentation.
This exposes the controller via a single ELB.
#
Step 2: Get ELB DNS for Ingress ControllerNote the external ELB DNS, e.g.:
#
Step 3: Set Up DNS in Cloudflare
- Go to DNS settings
- Add a record:
- Type:
CNAME
orA
- Name:
your-subdomain.yourdomain.com
- Target: ELB DNS
- Proxy status: DNS Only or Proxied
- Type:
For Cloudflare-specific optimizations, check Cloudflare’s Kubernetes integration guide.
#
Step 4: HTTP Host-Based Ingress ExampleHere's a sample Ingress manifest:
Apply the file:
Learn more about Ingress annotations in the Kubernetes Ingress documentation.
#
Step 5: Add TCP Support (Optional)#
Step 5.1: Create TCP ConfigMap#
Step 5.2: Upgrade Controller to Load TCP ConfigMapOr during first install:
For troubleshooting TCP routing, see NGINX’s TCP/UDP passthrough guide.
#
Step 6: Expose TCP Port in LoadBalancerEdit the controller service:
Add:
#
Routing OverviewType | Uses | Ingress Object? | ConfigMap? | DNS |
---|---|---|---|---|
HTTP | Web apps, APIs | Yes | No | Subdomain |
TCP | PostgreSQL, Redis | No | Yes | Same ELB + Port |
#
Tips- Use
ingressClassName: nginx
to prevent conflicts. - Use cert-manager for HTTPS/TLS termination.
- Isolate apps using namespaces.
- Annotate Ingress for rewrites, caching, rate-limiting, etc.
#
ConclusionWith this setup, you can serve both HTTP and TCP apps in your EKS cluster using a single LoadBalancer, simplifying your architecture and saving costs. HTTP traffic is managed using Ingress resources with host rules, while TCP apps like databases are handled using a custom ConfigMap.
This architecture is production-ready when combined with Cloudflare for DNS, TLS, and protection.
For cluster management solutions, explore our Nife's Managed Clusters platform.
Discover solutions for Managing Multiple Organizations across your infrastructure