Difficulty: Advanced
What is Ingress and how does it differ from a LoadBalancer service?
A **LoadBalancer** service requires a physical cloud load balancer per service, which can be expensive.
**Ingress** is an API object that manages external access to services, typically HTTP. It provides routing rules (host-based or path-based), SSL termination, and name-based virtual hosting.
Directing traffic to Ingress requires an **Ingress Controller** (like Nginx, Traefik, or Istio) to sit at the edge of the cluster, receive all traffic, and route it internally.
**In short**: Ingress is the 'Rulebook', and Ingress Controller is the 'Traffic Cop'.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: main-ingress
spec:
rules:
- host: myapp.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: api-service
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: frontend-service
port:
number: 80
This single Ingress object routes traffic to different services based on the URL path.
Ingress, Reverse Proxy, Nginx Ingress, SSL Termination