---
title: "Traffic, gateways, and service mesh"
chapter: "10"
---

# Traffic, gateways, and service mesh

Kubernetes Services create stable discovery for changing Pods.

## Traffic choices

- ClusterIP: internal virtual service.
- Headless Service: direct endpoint discovery.
- LoadBalancer Service: Layer 4 load balancing.
- Gateway API / Ingress: Layer 7 routing and Google Cloud load balancers.
- Multi Cluster Services/Ingress: selected fleet-wide discovery and traffic.

Use readiness gates and health checks so traffic reaches healthy Pods. Preserve
client IP only when the requirement justifies configuration and trade-offs.

## Gateway API

Gateway API separates infrastructure ownership from application routes. A
platform team can own Gateway classes and shared gateways while application
teams own permitted HTTPRoutes. This is usually clearer than letting every
namespace create unrelated load balancers.

## Service mesh

A mesh can add mutual TLS, traffic policy, telemetry, and service identity.
Cloud Service Mesh can manage parts of this. A mesh also adds proxies or
ambient components, policy, upgrades, latency, resource use, and debugging
complexity. Adopt it for explicit cross-service requirements, not because
microservices exist.

## Resilience

Use timeouts, bounded retries, circuit breaking, load shedding, graceful
degradation, and idempotency in the application and traffic layer. Do not allow
multiple retry layers to multiply requests.
