Sitemap

Configuring the NGINX Ingress Controller in Kubernetes

3 min readOct 16, 2026

--

Introduction:

In Kubernetes, Ingress is an API resource that manages external HTTP and HTTPS access to applications running inside a Kubernetes cluster.

Get Rameshk’s stories in your inbox

Join Medium for free to get updates from this writer.

There are several Ingress Controllers available, including:

  1. NGINX Ingress Controller
  2. Traefik Ingress Controller

In this article, we will learn about the NGINX Ingress Controller, how it works, and why it is useful for exposing Kubernetes applications.

Advantages of Ingress Controllers Over Kubernetes Services

  1. Kubernetes Services provide different ways to expose applications, such as ClusterIP, NodePort, and LoadBalancer. However, Ingress Controllers offer additional capabilities for managing HTTP and HTTPS traffic.
  2. When we expose multiple applications using Kubernetes LoadBalancer Services in a cloud environment such as AWS, each Service may provision a separate cloud load balancer.
  3. For example, if we have five applications and expose each one using a LoadBalancer Service, we may end up with five cloud load balancers, increasing infrastructure costs.
  4. An Ingress Controller provides centralized HTTP/HTTPS traffic management for Kubernetes applications. Its main advantages are host-based and path-based routing, shared load balancer usage, TLS termination, HTTPS redirection, and advanced traffic controls such as authentication and rate limiting.

How to configure the Nginx-Ingress:

  • First we need to deploy the Nginx-Ingress controller
## Nginx Ingress controller

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.12.0/deploy/static/provider/aws/deploy.yaml
  • It will create the new “namespace” called “ingress-nginx”
Press enter or click to view image in full size
  • Now we can create our namespace named as “dev”.
kubectl create namespace dev
  • Im using the “kubens” utility to switch betweeen the namespaces quickly.
  • To switch namespace
kubens dev
  • Now we need to create the Deployment, secret (for tls certificates) and the Service.
### For Deployment
kubectl create deployment dev-web --image rameshk9059/loading:login --replicas 2


### For TLS secrets

kubectl create secret tls wc-secret --cert fullchain.pem --key privkey.pem

### For Service

kubectl expose deployment dev-web --name dev-svc --port 80

#Deployment

# Service

Press enter or click to view image in full size

# Secrets

Press enter or click to view image in full size
  • Now its time to create the Nginx-Ingress
kubectl create ingress nginx-ingress --class nginx --rule 'app.rameshtrain.xyz/=dev-svc:80,tls=wc-secret'
Press enter or click to view image in full size
Press enter or click to view image in full size
Press enter or click to view image in full size

Note:

  • Ingress-controller can be in any namespace but the secrets, deployments,services,ingress all should be in the same namespace.
  • If you want to generate the yaml files from the above mentioned commands just add the below flags
kubectl create deployment dev-web --image rameshk9059/loading:login --replicas 2 --dry-run=client -o yaml

If you have any questions or feedback, please feel free to share them. I will be glad to help.

--

--