What is an Ingress Controller?

Nidhi Ashtikar
3 min readMay 2, 2024

--

Let’s Think Ingress Controller as a traffic cop for your Kubernetes cluster. It's like a gateway that helps manage how external users or services access applications running inside the cluster.

It directs traffic to the right place based on rules you set, like which service should handle requests for a particular web address.

“An Ingress Controller is an essential component in Kubernetes clusters used for managing external access to services running within the cluster. It acts as a reverse proxy to route traffic from outside the cluster to specific services based on defined rules.”

Here’s how the Ingress Controller works:

1. Configuration:

You, as the cluster administrator, define rules for how external traffic should be handled. These rules are specified using Kubernetes objects called “Ingress resources.”

For example, you might say that requests coming to a certain web address should be directed to a specific service in your cluster..

Imagine you have a Kubernetes cluster hosting multiple microservices.
You want to expose these services to the Internet.
You create an Ingress resource specifying that requests to example.com/app1 should be routed to the app1-service, and requests to example.com/app2 should go to app2-service.

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: example-ingress
spec:
rules:
- host: example.com
http:
paths:
- path: /app1
pathType: Prefix
backend:
service:
name: app1-service
port:
number: 80
- path: /app2
pathType: Prefix
backend:
service:
name: app2-service
port:
number: 80

2. Ingress Controller Watches:

The Ingress Controller continuously watches for changes in these Ingress resources.
Whenever a new Ingress resource is created, modified, or deleted, the controller notices and reacts accordingly.

Once you apply this manifest to your Kubernetes cluster (kubectl apply -f example-ingress.yaml), the Ingress Controller will detect and process it.

3. Traffic Routing:

When an external request comes in, it hits the Ingress Controller first.
The controller checks the rules you’ve set up in the Ingress resources to determine where the traffic should go.
It might send the request to a particular service based on the domain name in the request, the path, or other criteria you’ve defined.

When a user accesses example.com/app1 or example.com/app2,
The Ingress Controller routes the traffic to the corresponding services based on the rules defined in the Ingress resource.

4. Load Balancing and SSL :

In addition to routing, the Ingress Controller might handle other tasks like load balancing, and distributing incoming requests across multiple instances of a service to ensure they don’t get overwhelmed.
It can also manage SSL termination, decrypting encrypted traffic so it can be processed by the services inside the cluster.

If you have multiple replicas of app1-service or app2-service,
the Ingress Controller automatically load balances incoming traffic among them.
If SSL termination is enabled, it handles the decryption of encrypted traffic.

5. Proxying :

Once the Ingress Controller figures out where the request should go,
it acts as a proxy, forwarding the request to the appropriate service inside the Kubernetes cluster.

The Ingress Controller proxies incoming requests to the appropriate services (app1-service or app2-service) running inside the Kubernetes cluster.

6. Response Handling:

After the service processes the request and generates a response, the Ingress Controller receives the response and sends it back to the original requester.

If you found this guide helpful then do click on 👏 the button.

Follow for more Learning like this 😊

If there’s a specific topic you’re curious about, feel free to drop a personal note or comment. I’m here to help you explore whatever interests you!

Thanks for spending your valuable time learning to enhance your knowledge!

--

--

Nidhi Ashtikar
Nidhi Ashtikar

Written by Nidhi Ashtikar

Experienced AWS DevOps professional with a passion for writing insightful articles.

No responses yet