Nginx request for two or more nodes in Kubernetes
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
In Kubernetes, Nginx usually does not send one request directly to multiple nodes. Instead, Nginx forwards a request to a Kubernetes Service, and that service load-balances requests across matching pods, which may be running on different nodes. Once that model is clear, the behavior becomes much easier to design and debug.
Nginx Balances Across Pods, Not Node Names
Kubernetes networking is built around pods and services. Nodes are where the pods happen to run, but clients and proxies usually should not care about node identities.
The common request path looks like this:
- client sends a request to Nginx or Nginx Ingress
- Nginx forwards the request to a Kubernetes
Service - the service chooses one matching pod endpoint
- that pod may be on node A, node B, or node C
So if you have three replicas spread across two nodes, repeated requests can land on different nodes over time, but each individual HTTP request normally goes to one selected backend pod.
Deploy Multiple Replicas
To let traffic reach more than one node, you need multiple backend pod replicas and a scheduler that can place them on different nodes.
Then expose those pods with a service:
With that setup, Kubernetes can route each request to one of the three replicas.
Put Nginx In Front of the Service
If you are using Nginx Ingress Controller, define an Ingress resource that points to the service instead of individual pods or nodes.
This is the standard Kubernetes pattern. Nginx receives the external request, then Kubernetes service discovery and endpoint management decide which backend pod gets the request.
Verify That Requests Reach Pods on Different Nodes
You can confirm replica placement with:
That command shows which node each pod is running on. Then inspect the service endpoints:
If the endpoints belong to pods on multiple nodes, the service is eligible to spread traffic across those nodes. Repeated requests through Nginx should then hit different pods over time, depending on load-balancing behavior.
If You Really Need the Same Request to Reach Multiple Backends
Sometimes the question is not about load balancing but about request replication. By default, Nginx and Kubernetes services do not send a single request to two pods and merge the results. One request maps to one backend handling path.
If you need fan-out behavior, common approaches are:
- Nginx mirroring for shadow traffic
- application-level replication logic
- asynchronous messaging through Kafka, RabbitMQ, or similar systems
For example, Nginx mirror can duplicate traffic to another backend for testing, but the mirrored response is ignored. That is useful for canary validation, not for combining responses from multiple nodes.
Think in Terms of Services, Not Static Node Lists
Trying to hard-code Nginx upstreams to specific Kubernetes node IPs is usually the wrong design. Pods reschedule, nodes change, and Kubernetes already provides a stable abstraction through services and ingress. Let the control plane maintain endpoint membership for you.
If you want better spreading across nodes, focus on replica count, anti-affinity, and pod topology policies rather than trying to route to node names directly from Nginx.
Common Pitfalls
The biggest mistake is expecting one HTTP request to be processed by multiple nodes automatically. Standard load balancing sends each request to one selected backend. Another common problem is pointing Nginx at nodes instead of a service, which fights Kubernetes service discovery and breaks when pods move. Developers also forget that having multiple nodes is not enough by itself; you still need multiple pod replicas and a service selecting them. Finally, many debugging sessions come from not checking pod placement with kubectl get pods -o wide and assuming traffic is spread when all replicas actually landed on the same node.
Summary
- In Kubernetes, Nginx typically routes to a
Service, not directly to node addresses. - A service load-balances requests across matching pods, which may run on different nodes.
- One request normally goes to one backend pod, not to multiple nodes at once.
- Use a deployment with multiple replicas plus a service and ingress to spread traffic.
- Verify node distribution with
kubectl get pods -o wide. - If you need true fan-out, use mirroring or application-level replication instead of ordinary load balancing.
Related reading
- nginx tcp stream k8s - keep client connection open when upstream closes
- Nginx.ingress.kubernetes.io/proxy-body-size not working
- nginx.ingress.kubernetes.io/server-snippet annotation contains invalid word location
- No access token in .kube/config
- No access permission error with npm global install on docker image
- Not able to create kafka topic using docker-compose
- NGINX upstream timed out 110 Operation timed out
- No data points for Kubernetes Pods and nodes in Grafana - Prometheus Dashboard

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.