Full lesson
Explore the full explanation, examples, and visuals at your own pace.
Part 1
An Ingress object never handles a single packet. When a browser requests shop.example.com, DNS sends it to a cloud load balancer, which forwards the encrypted TLS stream to Traefik. Traefik is the ingress controller, a real proxy, and that's where your request actually lands.
traefik Service (installed with Traefik)
The load balancer comes from this Service. It's Traefik's own, and its type is LoadBalancer, so the cloud provider provisions an external load balancer for port 443. That load balancer's external IP is what the shop.example.com DNS record points to. The selector sends its traffic to the Traefik Pods.
apiVersion: v1
kind: Service
metadata:
name: traefik
namespace: traefik
spec:
type: LoadBalancer
selector:
app.kubernetes.io/name: traefik
ports:
- name: websecure
port: 443
targetPort: websecureStep 1: TLS reaches Traefik
The browser opens a TCP connection to the load balancer on port 443. In this setup it works at layer 4, so it just forwards the bytes to Traefik. Traefik reads the SNI in the ClientHello, picks the shop-tls certificate, and decrypts. Only then does it see GET /cart, with the Host header shop.example.com.
shop Ingress: just rules
Read this Ingress as plain data. It says: for host shop.example.com, any path starting with slash goes to shop-svc on port 80, with certificate secret shop-tls. The ingressClassName, traefik, names which controller should obey it. But nothing in this YAML listens on a port or runs.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: shop
spec:
ingressClassName: traefik
tls:
- hosts: [shop.example.com]
secretName: shop-tls
rules:
- host: shop.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: shop-svc
port:
number: 80Rules alone route nothing
With Rules only, the browser's request goes nowhere. The Ingress rules are stored, but no process listens, so the request is refused. With Rules plus Traefik, the browser reaches Traefik over HTTPS, and Traefik routes to the shop Pod. A wrong ingressClassName gives the same silent result.
Step 2: Traefik loads the rules
When you run kubectl apply, the API server just stores Ingress shop. Traefik is watching, so it gets a watch event. It also follows Services and EndpointSlices, then rebuilds its in-memory routers. Traefik goes from no route to route loaded, and that's when the rule starts to matter.
Step 3: matching GET /cart
Now Traefik compares the request against the rule, field by field. The host is shop.example.com, and that matches. The path /cart falls under Prefix slash, so that matches too. The backend is shop-svc on port 80. If no rule matched, Traefik would answer with a 404.
Step 4: Service names the Pods
The backend is shop-svc, but Traefik doesn't send the request to the Service's virtual IP. It reads shop-svc's endpoints, the Pod addresses its selector picked up, here 10.0.1.7 and 10.0.2.4. By default it proxies GET /cart straight to 10.0.1.7, and later requests can go to 10.0.2.4.
Control path vs data path
The request only travels through the cloud load balancer, Traefik, and the shop Pod. Ingress rules and shop-svc never touch it. They just configure Traefik, which watches the rules and reads the endpoints. Ingress is the rulebook, and Traefik is the one that obeys it.
Gotchas on this path
Three gotchas. TLS ends at Traefik, so your Pod gets plain HTTP with X-Forwarded headers. The client IP is hidden unless you preserve it, with externalTrafficPolicy Local or PROXY protocol. Redirects, auth and rate limits need Traefik annotations or middlewares.
- TLS ends at Traefik; Pod sees HTTP
- Client IP hidden unless explicitly preserved
- Extra behaviour needs controller-specific config
Check each hop
When a request fails, check one hop at a time. First, the traefik Service should have an EXTERNAL-IP, or the load balancer isn't there. Next, the shop Ingress should show an ADDRESS once Traefik publishes status. Last, the EndpointSlices for shop-svc must list ready Pod IPs, otherwise Traefik has nowhere to send traffic.
kubectl -n traefik get svc traefik
kubectl get ingress shop
kubectl get endpointslices \
-l kubernetes.io/service-name=shop-svcGateway API: the newer API Kubernetes recommends for new setups
Ingress still works, but Gateway API is the newer Kubernetes API, and the Kubernetes project recommends it for new setups.
Ingress is the rulebook; the ingress controller is the proxy obeying it.
Ingress is the rulebook; the ingress controller is the proxy obeying it. The rules only configure Traefik, and Traefik is what carries the request to the Pod. So when routing fails, debug the controller and its endpoints, not just the Ingress YAML.