From Phone to Kubernetes Pod: Tracing an API Call and Finding the 503
An API call from a phone resolves DNS, completes TLS at a CDN or load balancer, passes an ingress controller, and reaches a pod through a Service's endpoints. A 503 comes from an HTTP hop: the CDN, the load balancer, the ingress or gateway, or the application. DNS, Services, and kube-proxy never return status codes.
The path, hop by hop
A request from a phone to a pod crosses several systems. What each hop terminates decides how it can fail.
- DNS. The client resolves the API hostname, usually to a CDN or a cloud load balancer, not to anything inside the cluster. It can send traffic to the wrong place, but it never returns an HTTP status.
- TCP and TLS. The client connects and negotiates TLS with whatever is at the edge. Certificate and SNI failures show up as handshake errors in the client, not as status codes.
- CDN or edge proxy. If one is in front, it terminates TLS and opens its own connection to your origin.
- Cloud load balancer. It accepts the connection, picks a healthy target from its target group or backend service, and forwards.
- Ingress controller or gateway. An HTTP proxy inside the cluster (NGINX, Envoy, HAProxy, or a cloud implementation of Gateway API) matches host and path to a route, then picks an upstream address.
- Service and EndpointSlices. The Service is a stable name and virtual IP. EndpointSlices list the ready pod addresses behind it. Most ingress controllers read EndpointSlices and connect straight to pod IPs, skipping the virtual IP entirely.
- kube-proxy and the node. When something does connect to the Service IP, kube-proxy's iptables, IPVS, or nftables rules rewrite the destination to a pod.
- The pod. The container accepts the connection and the application answers, or does not.
A 503 can originate at hops 3, 4, 5, and 8. It cannot originate at hops 1, 2, 6, or 7, because none of them speak HTTP. That one fact removes half the search space.
Who can say 503, and why
The CDN. An edge proxy passes your origin's 503 through unchanged, or generates its own when it cannot reach or is protecting the origin. Generated errors carry the vendor's error page and headers. Passed-through errors carry your application's body.
The cloud load balancer. AWS documents that an Application Load Balancer returns 503 when its target groups have no registered targets, or all registered targets are in an unused state. A target group that drained to zero during a deploy, or a misconfigured controller that deregistered everything, produces exactly this. Unhealthy targets and refused connections usually surface as 502 or 504 instead, so the specific code is evidence.
The ingress controller or gateway. This is the most common source. ingress-nginx answers 503 when the route matches but the Service has no active endpoints, and its controller log says so. Envoy, which sits under many Gateway API implementations and service meshes, records why it returned 503 in its response flags: UH for no healthy upstream, UF for an upstream connection failure, UO for overflow from circuit breaking, and UC for an upstream connection terminated mid-request. The plain body no healthy upstream is Envoy's.
The pod. Applications return 503 on purpose: load shedding, a dependency that is down, a server still warming up, or a framework that answers 503 during graceful shutdown. That is the only 503 your application code wrote.
kube-proxy deserves a separate note. When a Service has zero endpoints, kube-proxy installs a REJECT rule, so a client connecting to the Service IP gets connection refused, not a status code. If an in-cluster caller reports 503 from a Service with no endpoints, the 503 came from a proxy between them, often a mesh sidecar.
Telling which hop answered
Work from the outside in, and let each hop prove it is not the source.
Read the response, not just the code. Capture headers and body with a verbose client from outside your network. A vendor error page, a server header naming the edge, or an Envoy no healthy upstream body each point at one hop. An application JSON error body means the request reached a pod.
Split load balancer errors from target errors. AWS publishes HTTPCode_ELB_5XX_Count separately from HTTPCode_Target_5XX_Count. If the first is rising, the load balancer generated the 503. If the second is rising, it forwarded one.
Read the ingress access log. NGINX logs $upstream_addr and $upstream_status. An empty or placeholder upstream with a 503 means the controller never reached a pod. An upstream address with status 503 means a pod answered 503. In Envoy, read the response flags field.
Check the endpoints directly. kubectl get endpointslices -l kubernetes.io/service-name=<svc> shows which addresses are ready. Zero ready addresses with running pods means readiness is failing or the selector no longer matches the pod labels.
Correlate with change. Line up the first 503 against rollouts, autoscaling events, node drains, and config pushes.
The patterns behind most Kubernetes 503s
Readiness probes that check dependencies. A probe that fails when the database is slow takes every replica out of the endpoints at once. A dependency blip becomes a total outage at the ingress. Readiness should reflect whether this pod can serve, not whether the world is healthy.
Label and selector drift. A refactor changes pod labels, the Service selector still points at the old ones, and the endpoints empty out on the next rollout.
Termination races. When a pod is deleted, removal from EndpointSlices and the SIGTERM to the container happen in parallel. Proxies that have not yet seen the update keep sending traffic to a process that is shutting down. A short preStop delay and a server that drains in-flight requests close most of the gap.
Rollouts that run out of capacity. Aggressive maxUnavailable, a slow-starting image, and no surge leave a window with too few ready pods for the traffic.
Circuit breakers set for a smaller load. A mesh with conservative connection or pending-request limits answers 503 with UO under a traffic spike, while every pod looks healthy.
Endpoint discovery is critical-path infrastructure. The same lesson at larger scale is in Spotify's service discovery outage, and the cluster-level failures that sit underneath these patterns are covered in how managed Kubernetes clusters fail.
Before the next one
Log upstream address and status at the ingress, and keep load-balancer-generated and target-generated error counts on the same dashboard. Alert on ready endpoints per Service falling below a floor, which catches the empty-endpoints case before customers do.
If the cluster still runs ingress-nginx, note that the Kubernetes project announced its retirement on November 11, 2025, with best-effort maintenance only until March 2026 and no security fixes after that. Existing installs keep working. A migration changes which logs and flags you read during a 503, so update the runbook with it.
When the incident closes, record the hop that answered as part of the cause. A year of cause codes that say "ingress, no endpoints, readiness" points at a specific fix in a way that "503" never will.
Frequently asked questions
- What does a 503 Service Unavailable mean in Kubernetes?
- It means some HTTP proxy or application in the request path decided it could not serve the request. In Kubernetes the usual source is the ingress controller or gateway finding no ready endpoints behind a Service. It can also come from a CDN, a cloud load balancer with no registered targets, a mesh circuit breaker, or the application itself shedding load.
- Does kube-proxy return 503 errors?
- No. kube-proxy works at the network layer and never writes HTTP responses. When a Service has no endpoints, kube-proxy installs a REJECT rule, so a connection to the Service IP is refused. If a caller sees a 503 instead, an HTTP proxy between the caller and the Service, such as an ingress controller or a mesh sidecar, translated that failure into a status code.
- How do you tell if a 503 came from the load balancer or the application?
- Look at the body and headers first: a proxy or vendor error page means infrastructure, an application error body means a pod answered. Then use metrics that separate the two. On AWS, HTTPCode_ELB_5XX_Count counts errors the load balancer generated, and HTTPCode_Target_5XX_Count counts errors targets returned. At the ingress, the access log shows whether an upstream pod was reached.
- Why do 503 errors happen during Kubernetes deployments?
- Usually because ready capacity dips during the rollout. Pods are removed from endpoints while proxies still route to them, new pods take time to pass readiness, or rollout settings allow too many replicas to be unavailable at once. A preStop delay, graceful request draining, surge capacity, and accurate readiness probes remove most deployment-time 503s.