Ingress: HTTP routing into the cluster
Route many hostnames and paths through one entry point instead of one load balancer per service.
Open this lesson in the learning hubKey points
- An Ingress is a set of HTTP rules mapping host and path to a Service. One cloud load balancer serves everything behind it.
- The Ingress object does nothing on its own. You must install a controller such as ingress-nginx, Traefik or the cloud's own.
- Choose the controller with
ingressClassName, and setpathTypetoPrefixorExacton every path. - TLS terminates here. Point
tls.secretNameat a Secret, or let cert-manager issue and renew it automatically. - Gateway API is the official successor and is GA. Before piling on more nginx annotations, check whether it fits.
Example
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
spec:
ingressClassName: nginx
tls:
- hosts:
- shop.example.com
secretName: shop-tls
rules:
- host: shop.example.com
http:
paths:
- path: /api
pathType: Prefix
backend:
service:
name: orders
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: web
port:
number: 80
One Ingress, one load balancer, many services. Gateway API is where this is heading.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kubernetes course, and every lesson in it is listed on the Kubernetes contents page.