nodemethod
KubernetesIntermediate

Layered load balancing and ingress

A global edge, a regional layer-7 load balancer and in-cluster ingress, each with its own health checks.

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.

KUBERNETES CLUSTER//apiVPN onlyWWWUsersworldwideSECEdge / CDNTLS, cache, WAFLBRegional L7 LBmulti-zoneLBIngress / Gatewayhost + path routesAPPwebServiceAPPapiServiceAPPadmininternal only
traffictunnel / replicationblocked

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

  1. The edge terminates TLS near the user, serves cached content and applies WAF rules.
  2. The regional load balancer accepts only edge traffic (for example by a secret header or managed prefix list) and spreads it across zones.
  3. The ingress controller or Gateway API routes by host and path to Kubernetes Services.
  4. 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 }

Examples are starting points. Review provider limits, names and versions for your environment before applying.

What to monitor

SignalWhy it matters
Error rate and latency at each layerComparing layers shows where a failure starts.
Healthy backends per layerA layer with no healthy backends returns errors immediately.
TLS certificate expiry at the edge and load balancerExpired certificates are still one of the most common outage causes.
Canary versus stable error ratesThe 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.

Checklist

0 of 5 done
Was this pattern useful?

Run this pattern with NodeMethod watching it.

NodeMethod is onboarding early-access teams now. Tell us about your environment and we will be in touch.

esc
↑↓ to move↵ to open