Four choices make every name
Builds on33. Proxies and load balancers
| # | Choice | Options | The question it answers |
|---|---|---|---|
| 1 | Reach | External · Internal | Where does the traffic come from? |
| 2 | Spread | Global · Regional | How widely is the load balancer distributed? |
| 3 | Layer | Application (L7) · Network (L4) | How much does it understand about the traffic? |
| 4 | Mode | Proxy · Passthrough | Does it end the client's connection and open its own? |
Read a name word by word and it explains itself. "Global external Application Load Balancer" is one IP worldwide, on the internet, that understands HTTP (and so must be a proxy). "Regional internal passthrough Network Load Balancer" is one region, private IP, L4 only, and does not end the connection. Not every combination exists.
Wide by design - scroll it sideways.
Try it:
Global external Application Load Balancer. Kadé's choice. One anycast IP on Google Front Ends, HTTP routing, TLS, Cloud Armor, Cloud CDN. Premium tier only.
External or internal
- Run by Google
- Your VPC
- Allowed traffic and replies
Wide by design - scroll it sideways.
| # | Reached from | IP | Typical use | |
|---|---|---|---|---|
| 1 | External | The internet | Public | The front door: a public website or API. Kadé's api.kade.lk |
| 2 | Internal | Inside your VPC, and networks connected to it (VPN, peering) | Private, from a subnet | Service to service, such as an API spreading calls across several payment workers, never exposed to the internet |
Global or regional
A global load balancer has one IP announced from Google's edge locations all over the world (anycast, Fundamentals ch 33). A regional one has an IP that belongs to one region and serves backends in that region.
Global: every user enters Google's network nearby and rides the backbone. Regional: every user travels to the region, over Premium or Standard tier (chapter 3).
| # | Choose global when | Choose regional when |
|---|---|---|
| 1 | Users are in several countries | The service and its users are in one region |
| 2 | You want routing to the nearest healthy region and failover between regions from one IP | A rule says traffic must stay in one region, including TLS termination |
| 3 | You want Cloud CDN, or Cloud Armor edge policies | You want Standard network tier (chapter 3), or a simpler model |
Application (L7) or Network (L4)
Builds on24. HTTP
| # | Understands | Can do | Used for | |
|---|---|---|---|---|
| 1 | Application (L7) | HTTP and HTTPS: host, path, headers, cookies | Route by host and path, end TLS, change headers, run a WAF, cache | Anything web |
| 2 | Network (L4) | IP addresses, protocol, ports | Spread connections across backends. That is all | Non-HTTP protocols (a database, a game server, a custom TCP or UDP service), or when the load balancer should stay out of the way |
Proxy or passthrough: the choice that changes behaviour
Does the load balancer end the client's connection and open a new one to the backend, or let the original connection pass straight through? Everything else follows from that.
What the backend sees
- TCP source
- 35.191.8.20 ← Google's front end, not the client
- X-Forwarded-For
- 203.0.113.99, 34.120.88.10 ← the real client is here
- TLS
- ended at the load balancer; HTTP inside
- Possible here
- host/path routing · Cloud Armor · header changes · CDN
The client's TCP and TLS connection ends at Google's front end. A second, separate connection goes to the backend. Because the front end holds the decrypted request, it can route it, run Cloud Armor and add headers. The backend sees the front end's address as the source, and the client's address only in X-Forwarded-For.
Show as config
client ──connection 1──▶ load balancer ──connection 2──▶ backend backend sees: source 35.191.8.20, X-Forwarded-For: 203.0.113.99, 34.120.88.10
| # | Proxy | Passthrough | |
|---|---|---|---|
| 1 | Connections | Two: client to load balancer, load balancer to backend | One: client to backend; the load balancer only steers packets |
| 2 | Source IP the backend sees | The load balancer's (35.191.x.x or a proxy-only subnet address). Real client in X-Forwarded-For | The real client's |
| 3 | HTTP routing, TLS termination, WAF, header changes, caching | Possible, because it has ended the connection and can read it | Impossible: it never reads the traffic |
| 4 | Replies | Go back through the load balancer | Go straight from the backend to the client (direct server return) |
| 5 | Protocols | TCP (and HTTP on top) | TCP, UDP, and others such as ESP and ICMP |
| 6 | Layer | L7 or L4 | Always L4: you cannot read HTTP without ending the connection |
| # | You need | Use |
|---|---|---|
| 1 | HTTP routing, a WAF, TLS termination at the load balancer | Proxy (an Application Load Balancer) |
| 2 | The backend to see the real client IP at the network level | Passthrough |
| 3 | UDP or another non-TCP protocol | Passthrough |
| 4 | The load balancer to stay out of the connection (end-to-end TLS the backend handles) | Passthrough |
Where it runs, and what your backends see
The four choices also decide where the load balancer runs. That matters for one practical reason: it sets the source address your backends see, and so the firewall rule they need.
- Run by Google
- Your VPC
- Allowed traffic and replies
Wide by design - scroll it sideways.
| # | Kind | Runs on | Backend firewall must allow |
|---|---|---|---|
| 1 | Global external proxies | Google Front Ends, outside your VPC | 35.191.0.0/16 and 130.211.0.0/22, for traffic and health checks |
| 2 | Regional and internal proxies | Envoy in a proxy-only subnet, inside your VPC | The proxy-only subnet's range for traffic, plus Google's health check ranges |
| 3 | Passthrough | The data plane on each backend's host (chapter 1.2) | The real clients' addresses, plus Google's health check ranges |
The whole family, and how to choose
Put the four choices together and these are the load balancers that exist today:
- Run by Google
Wide by design - scroll it sideways.
| # | Load balancer | Reach | Spread | Mode | Runs on |
|---|---|---|---|---|---|
| 1 | Global external Application LB | External | Global | Proxy, L7 | Google Front Ends; also a "classic" version with fewer routing features |
| 2 | Regional external Application LB | External | Regional | Proxy, L7 | Envoy in a proxy-only subnet |
| 3 | Cross-region internal Application LB | Internal | Global | Proxy, L7 | Envoy in a proxy-only subnet |
| 4 | Regional internal Application LB | Internal | Regional | Proxy, L7 | Envoy in a proxy-only subnet |
| 5 | Global external proxy Network LB | External | Global | Proxy, L4 (TCP, optional TLS) | Google Front Ends |
| 6 | Regional external proxy Network LB | External | Regional | Proxy, L4 | Envoy in a proxy-only subnet |
| 7 | Internal proxy Network LB (regional or cross-region) | Internal | Either | Proxy, L4 | Envoy in a proxy-only subnet |
| 8 | External passthrough Network LB | External | Regional | Passthrough, L4 | The data plane on each host (chapter 1.2) |
| 9 | Internal passthrough Network LB | Internal | Regional | Passthrough, L4 | The data plane; can also be a route's next hop (chapter 4) |
Choosing is a short walk down four questions:
Back to Kadé
Commands in this chapter
All read-only.
List forwarding rules (the front of every load balancer)
- What it shows: Every load balancer's IP, port, scope and scheme.
- What to look for:
EXTERNAL_MANAGED(the newer global or regional external Application LB),EXTERNAL(classic or passthrough),INTERNALorINTERNAL_MANAGED.
gcloud compute forwarding-rules list \ --format="table(name,region.basename(),IPAddress,portRange,loadBalancingScheme,target.basename())"List backend services
- What it shows: Each backend service with its scheme, protocol and whether it is global.
- What to look for: The protocol (
HTTP,HTTPS,TCP,UDP) tells you L7 or L4.
gcloud compute backend-services list \ --format="table(name,region.basename(),loadBalancingScheme,protocol)"List proxy-only subnets
- What it shows: Subnets reserved for Envoy-based load balancers.
- What to look for: None for Kadé. One per region is needed before creating a regional or internal Application LB.
gcloud compute networks subnets list \ --filter="purpose~MANAGED_PROXY" --format="table(name,region.basename(),ipCidrRange,purpose,role)"