Lesson 120 · Section 9: Networking
Lesson 120: Ingress networking: how a request travels from the internet to a Pod
What an Ingress controller is made of, how it is exposed, the full path of a request from DNS to the Pod, why the controller talks to Pods directly, where TLS ends and where the client address goes, and a step by step way to find the broken link when an Ingress does not answer. · 20 min read · 3 min video
Official competencies this lesson covers
Narrated by the local narrator voice. Keys: Space plays and pauses, J and L step, C captions, F full screen.
Why it exists
Lesson 118 treated the Ingress controller as a box that "does the routing". That is enough to write an Ingress. It
is not enough when the Ingress exists and curl hangs, or answers 503. To fix that you need to know what the box
is made of and which hops a request takes.
What it is
The parts of a controller installation
Installing a controller, with a manifest or a Helm chart, creates a handful of ordinary objects, usually in a namespace of their own. The names below are those of the NGINX-based community controller; other controllers have the same parts under other names.
Parts:
- Service (LoadBalancer/NodePort), in Namespace ingress-nginx
- Deployment (controller Pods), in Namespace ingress-nginx
- ConfigMap (proxy defaults), in Namespace ingress-nginx
- IngressClass (name: nginx)
- ServiceAccount (plus ClusterRole), in Namespace ingress-nginx
- Admission webhook (checks Ingresses), in Namespace ingress-nginx
Connections:
- Service to Deployment: 80, 443
- ConfigMap to Deployment: config
- ServiceAccount to Deployment: runs as
| Object | Why it is needed |
|---|---|
| Deployment (or DaemonSet) | Runs the controller Pods: the proxy plus the program that configures it |
| Service of type LoadBalancer or NodePort | The door: exposes ports 80 and 443 of the controller Pods to the outside |
| ConfigMap | Proxy defaults for all Ingresses: timeouts, log format, TLS versions |
| ServiceAccount, ClusterRole, ClusterRoleBinding | Lets the controller watch Ingresses, Services, EndpointSlices and Secrets in all namespaces, and write Ingress status |
| IngressClass | The name your Ingresses put in ingressClassName; its spec.controller identifies this controller |
| Admission webhook (optional) | Checks every Ingress at kubectl apply time and rejects ones the proxy could not load |
kubectl get ingressclass
kubectl -n ingress-nginx get deploy,pods,svc,cm
NAME CONTROLLER PARAMETERS AGE
nginx k8s.io/ingress-nginx <none> 9d
NAME READY UP-TO-DATE AVAILABLE
deployment.apps/ingress-nginx-controller 1/1 1 1
NAME READY STATUS RESTARTS
pod/ingress-nginx-controller-7d4c9b8f6-x2kqp 1/1 Running 0
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S)
service/ingress-nginx-controller NodePort 10.104.22.9 <none> 80:30080/TCP,443:30443/TCP
service/ingress-nginx-controller-admission ClusterIP 10.98.140.3 <none> 443/TCP
The Service line tells you how to reach the controller. Here it is a NodePort: HTTP on port 30080 and HTTPS on port 30443 of every node.
How it works
The path of one request
Parts:
- Client (shop.example.com)
- Load balancer (203.0.113.10:443)
- Node (nodePort :30443)
- Controller Pod (ends TLS, routes)
- shop Pod (10.244.2.4:8080)
- Service shop (ClusterIP, port 80)
Connections:
- Client to Load balancer: HTTPS
- Load balancer to Node: :30443
- Node to Controller Pod: kube-proxy
- Controller Pod to shop Pod: HTTP
- Service shop to shop Pod: selects
- DNS. The client resolves
shop.example.com. The record points at the address in front of the controller: a cloud load balancer, or a node. Kubernetes does not create this record for you. - Into the cluster. The connection enters through the controller's Service, exactly as lessons 19 to 21 described for any Service: load balancer to node port, or straight to a node port.
- To a controller Pod. kube-proxy's rules on the node forward the connection to one of the controller Pods.
- Routing. The controller ends the TLS connection if the port is 443, reads the
Hostheader and the path, and finds the matching rule. - To an application Pod. The controller opens a new HTTP connection to the IP address and port of one application Pod.
- Back. The answer returns over the same two connections.
The application's Service is a phone book, not a hop
Step 5 is the part most people get wrong. The Ingress names a Service, so it is natural to assume traffic flows through the Service's cluster IP. It does not. The controller looks up the Service's EndpointSlices, which list the ready Pods, and balances between those Pod addresses itself.
That has consequences you can use:
- The application's Service can be plain ClusterIP. It needs no node port.
- The Service must still be correct: the right selector and the right
targetPort. No endpoints means no Pods to send to, and the controller answers503. - Only ready Pods receive traffic, because only they are listed. A failing readiness probe removes a Pod from the Ingress as well as from the Service.
- A NetworkPolicy on the application Pods sees connections coming from the controller Pods, so it must allow the controller's namespace (lessons 87 and 88).
How the controller stays up to date
Parts:
- Ingresses (rules)
- EndpointSlices (ready Pod IPs)
- Secrets (TLS certificates)
- API server (watch)
- Controller (builds the config)
- Ingress status (ADDRESS column)
Connections:
- Ingresses to API server
- EndpointSlices to API server
- Secrets to API server
- API server to Controller: events
- Controller to Ingress status: writes address
The controller holds a watch on the API server for Ingresses of its class, the Services and EndpointSlices they
name, and the Secrets in their tls sections. When anything changes it rebuilds the proxy configuration. Scaling
a Deployment from 2 to 5 Pods needs no change to the Ingress: three new addresses appear in the EndpointSlice and
the controller starts using them.
The controller also writes back. It puts the address clients should use into status.loadBalancer of every
Ingress it serves, and kubectl get ingress shows that in the ADDRESS column. An empty ADDRESS after a minute
is a strong sign that no controller has accepted this Ingress.
Where TLS ends, and what the Pod sees
| Leg | Protocol | Notes |
|---|---|---|
| Client to controller | HTTPS | The certificate comes from the Secret named in the Ingress's tls section |
| Controller to Pod | HTTP | Plain, inside the cluster network, unless an annotation asks for HTTPS |
Because the controller opens a new connection, the application Pod sees the controller Pod's IP as the client
address. The real client address is passed in the HTTP header X-Forwarded-For, and the original scheme in
X-Forwarded-Proto.
If the host has no usable certificate, because the Secret is missing, in another namespace or issued for another
name, the NGINX-based controller serves its built-in self-signed one, named "Kubernetes Ingress Controller Fake
Certificate". Seeing that name in curl -kv output means the tls section is not working.
Ways to expose the controller
| Method | How traffic arrives | Typical place |
|---|---|---|
| Service type LoadBalancer | Cloud load balancer on 80 and 443 | Managed clusters in a cloud |
| Service type NodePort | Any node on a high port such as 30080 | kubeadm clusters, labs, the exam |
| hostNetwork or hostPort | The node's own ports 80 and 443, no Service in between | Bare metal, often as a DaemonSet on edge nodes |
Under the hood · Details: client addresses, several controllers, and deploying one yourself
- Keeping the client address. With a NodePort or LoadBalancer Service, a node may forward the connection to a
controller Pod on another node and replace the source address on the way. Setting
externalTrafficPolicy: Localon the controller's Service keeps the client address up to the controller, which then reports it inX-Forwarded-For. - Several controllers. Each has its own IngressClass, its own Service and so its own address. An Ingress belongs to exactly one of them. This is how clusters separate public from internal traffic.
- The admission webhook can block you. If the controller's Pods are down, creating an Ingress may fail with
failed calling webhook "validate.nginx.ingress.kubernetes.io". The problem is the controller, not your YAML. - Deploying one by hand means creating everything in the table above. The pieces people forget are the RBAC rules (the controller starts, then logs "forbidden" errors and never loads a rule) and the IngressClass (the controller runs, and ignores every Ingress). In the exam the controller is normally installed already, or you are given a manifest or a Helm chart to apply.
- Inside the cluster other Pods can use the Ingress too, by calling the controller's Service, for example
ingress-nginx-controller.ingress-nginx.svc, with the right Host header. Usually they call the application's Service directly instead.
Using it: find the broken hop
Parts:
- 1. Reach controller (timeout, refused)
- 2. Class picked up (no ADDRESS)
- 3. Rule matches (404 from the proxy)
- 4. Service has Pods (503)
- 5. Pod accepts (502, 504)
- 6. App answers (404 from the app)
Connections:
- 1. Reach controller to 2. Class picked up
- 2. Class picked up to 3. Rule matches
- 3. Rule matches to 4. Service has Pods
- 4. Service has Pods to 5. Pod accepts
- 5. Pod accepts to 6. App answers
| Symptom | The hop that fails | Check |
|---|---|---|
| Timeout or "connection refused" | You never reached the controller | Controller Pods running? Its Service type and ports? Right node port? |
ADDRESS empty, proxy's default 404 for everything | No controller owns the Ingress | kubectl get ingressclass, spec.ingressClassName |
404 with the proxy's own error page | No rule matched | Host header, path, pathType, namespace |
503 Service Temporarily Unavailable | The Service has no ready endpoints | Service name, selector, Pod readiness |
502 Bad Gateway or 504 Gateway Timeout | The Pod did not accept or answer | Service targetPort, container port, NetworkPolicy, protocol |
404 in the application's own format | Routing works; the app does not know the path | Rewrite (lesson 119) |
| Certificate warning, "Fake Certificate" | TLS Secret not used | Secret name, namespace, type, host in tls.hosts |
Example · A 503: the Service selects nothing
curl -s -o /dev/null -w '%{http_code}\n' -H "Host: shop.example.com" http://node01:30080/
503
A 503 from the controller means the rule matched and there was nobody to send to. Look at the backends:
kubectl -n web describe ingress shop
Rules:
Host Path Backends
---- ---- --------
shop.example.com
/ shop:80 (<none>)
<none>: the Service exists and has no endpoints. Compare its selector with the Pod labels:
kubectl -n web get svc shop -o wide
kubectl -n web get pods --show-labels
NAME TYPE CLUSTER-IP PORT(S) SELECTOR
shop ClusterIP 10.99.14.201 80/TCP app=shop-web
NAME READY STATUS LABELS
shop-6c9f7b5d8-4hx2m 1/1 Running app=shop
The selector says app=shop-web, the Pods carry app=shop. Fix the selector
(kubectl -n web set selector svc shop app=shop) and the Ingress works without being touched.
Example · A 404: which side returned it?
curl -i -H "Host: shop.example.com" http://node01:30080/cart
Read the body and the headers. The proxy's own 404 is a tiny HTML page that names the proxy, such as nginx. The
application's 404 looks like the application. If it is the proxy's:
kubectl get ingress -A # is there a rule for this host at all? In which class?
kubectl -n web get ingress shop -o yaml # host spelled right? path and pathType?
The usual causes: the request was sent without the Host header, the Ingress has pathType: Exact where a
prefix was meant, or the Ingress names a class no controller serves.
Example · A 502: the wrong port
shop:80 (10.244.2.4:80,10.244.1.7:80)
describe shows endpoints, so the selector is right. But the container listens on 8080 and the endpoints say
port 80: the Service's targetPort is wrong. The controller connects to 10.244.2.4:80, the Pod refuses, and the
client gets a 502.
kubectl -n web get pod -l app=shop -o jsonpath='{.items[0].spec.containers[0].ports}'
kubectl -n web patch svc shop -p '{"spec":{"ports":[{"port":80,"targetPort":8080}]}}'
Example · Ask the controller itself
The controller logs every request and every configuration problem:
kubectl -n ingress-nginx logs deploy/ingress-nginx-controller --tail=20
W1202 10:14:07 controller.go:1112] Service "web/shop" does not have any active Endpoint.
10.244.0.1 - - [02/Dec/2026:10:14:09 +0000] "GET / HTTP/1.1" 503 190 "-" "curl/8.5.0" 76 0.000 [web-shop-80] [] - - - -
The warning names the Service, and the access line shows the status and which backend was chosen (web-shop-80).
A request that never appears in this log never reached the controller: look at hop 1.
Tricks
Common mistakes
- Testing on port 80 when the controller is a NodePort Service. Use the node port from
get svc. - Giving the application Service a node port "for the Ingress". Not needed; ClusterIP is enough.
- Assuming traffic goes through the Service's cluster IP. It goes to Pod addresses, so a NetworkPolicy must allow the controller Pods, and readiness decides who gets traffic.
- Fixing the Ingress when the Service is broken. A 503 or 502 is almost always a selector or
targetPort. - Forgetting the Host header. A rule with a host matches nothing when you call the bare address.
- Looking for the controller in
kube-system. It normally has its own namespace. - Expecting the Pod to see the client's address. It sees the controller; read
X-Forwarded-For. - Deleting the controller's Service or IngressClass while "cleaning up". Every Ingress stops working at once.
Recap
- A controller installation is a Deployment, a Service, a ConfigMap, RBAC and an IngressClass, in its own namespace.
- A request takes two legs: outside to the controller through the controller's Service, then controller to a Pod address taken from the application Service's EndpointSlices.
- The controller watches Ingresses, EndpointSlices and Secrets, and writes the
ADDRESSinto the Ingress status. - TLS ends at the controller; the Pod sees the controller's address and the
X-Forwarded-Forheader. - Troubleshoot from the outside in, and let the status code tell you which hop to look at.
Official docs
Quiz: check what you learned
5 questions on this lesson · about 3 min · instant feedback. Missed questions come back in your review queue.
Sign in to take the quiz and keep your score.
Discussion
Learners ask and answer questions here. Sign in to read and join the discussion.