Difficulty: Advanced
What is an Ingress in Kubernetes, how does an Ingress controller work, and how does it differ from exposing a service with type LoadBalancer?
An Ingress is a Kubernetes object that defines Layer 7 (HTTP/HTTPS) routing rules, such as "send api.shop.in/orders to the orders Service", and an Ingress controller is the reverse proxy (NGINX, Traefik, HAProxy, a cloud ALB) that reads those rules and enforces them. A LoadBalancer Service works at Layer 4 and gives one service its own external IP, while a single Ingress can route many hostnames and paths to many services behind one load balancer.
An Ingress object on its own does nothing. Without a controller in the cluster, nothing listens. The ingressClassName field picks which controller handles a given Ingress when you run more than one.
| Aspect | LoadBalancer Service | Ingress |
|---|---|---|
| OSI layer | L4 (TCP/UDP) | L7 (HTTP/HTTPS) |
| Routing | One IP per service | Host and path based, many services |
| TLS | Passed through or handled by cloud LB | Terminated at the controller using a Secret |
| Cost | One cloud LB per service | One LB shared by all routes |
| Protocols | Any TCP/UDP | Mainly HTTP; TCP/UDP only via controller-specific hacks |
For an e-commerce platform with shop.in, api.shop.in and admin.shop.in backed by ten services, Ingress needs one load balancer; LoadBalancer Services would need ten.
kubernetes.io/tls Secret, often issued automatically by cert-manager with Let's Encrypt.nginx.ingress.kubernetes.io/rewrite-target).Prefix, Exact and ImplementationSpecific.The Ingress API is stable but frozen. Its successor is the Gateway API (GA since late 2023), which splits responsibilities into GatewayClass, Gateway and HTTPRoute, and supports header matching, traffic splitting and TCP/gRPC routes as first-class fields instead of annotations. The community ingress-nginx project announced its retirement, with best-effort maintenance ending in March 2026, so new clusters are moving to Gateway API implementations (Envoy Gateway, Istio, Cilium, NGINX Gateway Fabric) or to other maintained controllers. Mentioning this in an interview shows you are current.
ingressClassName, then wondering why the Ingress has no address.apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: nginx # which controller handles this
tls:
- hosts: [api.shop.in]
secretName: api-shop-tls # cert-manager fills this Secret
rules:
- host: api.shop.in
http:
paths:
- path: /orders
pathType: Prefix
backend:
service:
name: orders
port:
number: 80
- path: /payments
pathType: Prefix
backend:
service:
name: payments
port:
number: 80
Both services stay ClusterIP. The controller terminates TLS for api.shop.in and routes by path.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: orders
spec:
parentRefs:
- name: public-gateway # Gateway owned by the platform team
hostnames: ["api.shop.in"]
rules:
- matches:
- path: { type: PathPrefix, value: /orders }
backendRefs:
- name: orders
port: 80
Gateway API separates the shared Gateway (owned by platform or ops) from the routes that app teams own.
Ingress, Ingress Controller, Gateway API, TLS Termination, Host and Path Routing