Sub topic 4
Ingress controllers: what actually handles traffic
This chapter assumes you know Pods, Deployments, and ClusterIP Services, and that you can apply YAML with kubectl. It also assumes you know what an Ingress resource looks like. Here you learn which component acts on that resource.
A resource is only a request
An Ingress resource is a record in the Kubernetes API. It states routing intent, such as "send shop.example.com/api to the api Service". Creating it moves no traffic.
An Ingress controller is a program running in the cluster that reads Ingress resources and does the routing. Kubernetes does not ship one. If none is installed, your Ingress is stored and never acted on.
What a controller consists of
A controller usually has two parts, often in the same Pod:
- A proxy that accepts HTTP and HTTPS connections and forwards them. Common choices are NGINX, HAProxy, Envoy, and Traefik.
- A control loop that watches the API server for Ingresses, IngressClasses, Services, EndpointSlices, and TLS Secrets. When any of them change, it rewrites the proxy configuration and reloads it.
The controller sends traffic straight to Pod IPs taken from the Service's endpoints. It uses the Service only to find which Pods back it. Most controllers skip kube-proxy load balancing for this reason.
How a request flows
The controller itself must be reachable from outside the cluster. Usually it runs as a Deployment or DaemonSet, exposed by one Service of type LoadBalancer or NodePort. That one external entry point replaces a LoadBalancer per application.
The dotted line is the control path. The solid lines are the data path. Application traffic never goes through the API server.
Checking that a controller is working
Look for the controller Pods first. The namespace depends on how you installed it. Then check whether your Ingress received an address.
kubectl get ingress shop
kubectl describe ingress shop
kubectl get ingressclassThe ADDRESS column of kubectl get ingress is filled in by the controller after it accepts the Ingress. It is usually the external IP or hostname of the controller's own Service. An empty address often means no controller is handling that Ingress, or the controller's Service has no external IP yet.
kubectl describe ingress lists each rule with the backend Pod IPs the controller resolved, plus recent events. If a backend shows <error: endpoints "api" not found>, the Service name or port in the Ingress is wrong, or the Service has no ready Pods.
Common controller problems
| Symptom | Likely cause |
|---|---|
| Ingress has no address | No controller installed, or class does not match any controller |
| Address is `<pending>` on the controller Service | Cluster cannot provision a load balancer, as on bare metal without an add-on |
| 404 from the controller | Request host or path matched no rule |
| 503 from the controller | Rule matched, but the Service has no ready endpoints |
| Config seems ignored | Annotations written for a different controller |
A 404 or 503 with a controller's error page proves the controller is running. The problem is in the rules or the backends, not in the network path to the controller.
Choosing a controller
Pick on operational fit, not just features.
- Cloud-managed controllers create the provider's own load balancer. They require less to run but tie you to that provider.
- In-cluster proxy controllers (NGINX, Traefik, HAProxy, Envoy-based) run on your nodes. They work anywhere, and you patch and scale them yourself.
- Features beyond the core Ingress fields, such as rate limits or rewrites, differ between controllers. They are configured with annotations, which are not portable.
Whichever you pick, run more than one replica and give the controller Pods resource requests. They are on the path of all your HTTP traffic, so one crashed Pod can cause an outage.
Exercise
You create an Ingress and apply it successfully, but kubectl get ingress shows an empty ADDRESS and requests to the cluster fail. Name two possible causes and one command to investigate.
Show answer
Either no Ingress controller is installed, or no installed controller handles this Ingress's class. The controller's own Service may also lack an external IP. Run kubectl get ingressclass to see which classes exist, and kubectl describe ingress <name> to read events and resolved backends.