d
WE ARE EXPERTS IN TECHNOLOGY

Let’s Work Together

n

StatusNeo

How Kubernetes Ingress Makes Traffic Management Easy

Ingress in Kubernetes manages external traffic by providing advanced routing, SSL termination, and security features. Unlike basic Kubernetes Services, Ingress enables path-based and host-based routing. It requires an Ingress Controller, such as NGINX or Traefik, to function. This helps efficiently direct traffic to the right services inside the cluster.


Before Ingress: How Did We Handle Traffic?

Before containers became popular, applications were deployed directly on Virtual Machines (VMs). To manage incoming traffic, we used load balancers, which provided several useful features like:
Security (e.g., SSL termination)
Whitelisting & Blacklisting (Allow/Deny access)
Path-based & Host-based routing

However, when we moved to containerized applications running in Kubernetes, things changed.

The Problem with Traditional Kubernetes Services

In Kubernetes, we use Deployments to manage and scale applications easily. But to expose these applications to the outside world, we use Service resources, which mainly do round-robin load balancing(forward incoming requests to the applications)

What’s missing?

  • No advanced routing (like path-based or host-based)
  • No security features (like SSL termination)
  • No traffic control (like whitelisting or blacklisting)

This is where Ingress comes to the rescue!

What is Ingress?

Ingress is a Kubernetes resource that provides a way to manage external access to services inside the cluster. It acts as a smart traffic manager, offering advanced load balancing features like:
Path-based & Host-based routing
Secure traffic handling with SSL/TLS
Rate limiting, authentication, and more

But Ingress alone doesn’t work on its own—it needs an Ingress Controller to function.

Ingress Architecture: Two Key Components

Ingress Resource
Ingress Controller

How Does an Ingress Controller Work?

Think of the Ingress Controller as a set of templates provided by different load balancer solutions. Some popular Ingress Controllers include:

  • NGINX Ingress Controller
  • Traefik Ingress Controller
  • Ambassador Ingress Controller

Setting Up Ingress: A Simple Example

Let’s say we have two services running in Kubernetes:

  1. A frontend (frontend-service)
  2. A backend (backend-service)

We want to expose them using different paths like:

  • example.com/frontend → Routes to frontend-service
  • example.com/backend → Routes to backend-service

Step 1: Deploy an Ingress Controller

Before we can use Ingress, we must deploy an Ingress Controller. For example, to deploy the NGINX Ingress Controller, we can run:( we can get the commands from the specific load balancer website)

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml

Step 2: Create an Ingress Resource

Once the controller is deployed, we define an Ingress Resource to route traffic:

apiVersion: networking.k8s.io/v1

kind: Ingress

metadata:

  name: my-ingress

spec:

  rules:

  – host: example.com

    http:

      paths:

      – path: /frontend

        pathType: Prefix

        backend:

          service:

            name: frontend-service

            port:

              number: 80

      – path: /backend

        pathType: Prefix

        backend:

          service:

            name: backend-service

            port:

              number: 80

Step 3: Apply the Ingress Resource

kubectl apply -f my-ingress.yaml

Now, traffic to  example.com   /frontend will go to frontend-service, and example.com /backend will go to backend-service.

Summary

  • Ingress helps Kubernetes handle external traffic smartly.
  • You need an Ingress Controller to make it work.
  • Popular Ingress Controllers include NGINX, Traefik, and Ambassador.
  • Ingress allows advanced routing, security, and load balancing.