Traffic usually crosses several load balancers before it reaches a container: a global anycast edge or CDN, a regional application load balancer, and an ingress controller or gateway inside the cluster. Each layer has a job: the edge absorbs volume and terminates TLS close to users, the regional layer spreads load across zones, and ingress routes by host and path to services.
- Detect
- Analyze
- Resolve
When to use it
- Public web applications and APIs
- Multiple services behind one domain
- Blue-green and canary releases
When to avoid it
- Adding layers that duplicate each other's work, which adds latency and more places to misconfigure
How traffic flows
- The edge terminates TLS near the user, serves cached content and applies WAF rules.
- The regional load balancer accepts only edge traffic (for example by a secret header or managed prefix list) and spreads it across zones.
- The ingress controller or Gateway API routes by host and path to Kubernetes Services.
- Readiness probes decide which pods receive traffic; the load balancer health check targets the ingress layer.
Configuration examples
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: shop
namespace: shop
spec:
parentRefs:
- name: public
namespace: gateway
hostnames: ["shop.example.com"]
rules:
- matches:
- path: { type: PathPrefix, value: /api }
backendRefs:
- { name: api-v2, port: 9000, weight: 90 }
- { name: api-v3, port: 9000, weight: 10 } # canary
- backendRefs:
- { name: web, port: 8080 }readinessProbe:
httpGet:
path: /healthz/ready # checks the database connection pool too
port: 9000
periodSeconds: 5
failureThreshold: 3
lifecycle:
preStop:
exec: { command: ["sleep", "10"] } # let the LB drain before shutdownExamples are starting points. Review provider limits, names and versions for your environment before applying.
What to monitor
| Signal | Why it matters |
|---|---|
| Error rate and latency at each layer | Comparing layers shows where a failure starts. |
| Healthy backends per layer | A layer with no healthy backends returns errors immediately. |
| TLS certificate expiry at the edge and load balancer | Expired certificates are still one of the most common outage causes. |
| Canary versus stable error rates | The basis for automatic promotion or rollback. |
Common failure modes
Origin reachable directly
Attackers bypass the edge and its WAF by hitting the load balancer address.
Sentinel checks that the load balancer only accepts edge traffic.
No drain on shutdown
Pods are killed while still receiving traffic, causing a burst of 502s on every deploy.
Lens correlates 502 bursts with rollout events and recommends a preStop delay.