A team we worked with had eleven services and were about to install a service mesh "because microservices need one". Their actual problems were an inconsistent auth check on public endpoints and a retry storm between two services. A gateway fixed the first in a week. A timeout and retry budget in one client library fixed the second in a day. The mesh project was shelved, and nobody missed it.
This post explains what an API gateway and a service mesh each solve, where they overlap, what a mesh costs to operate, and a staged path that starts with neither. It assumes Kubernetes but the ideas apply elsewhere.
Two directions of traffic
North-south traffic enters or leaves your system: browsers, mobile apps, partners calling your public API.
East-west traffic flows between your own services inside the system.
An API gateway sits on the north-south path. A service mesh manages the east-west path. That one distinction explains most of the differences.
What an API gateway does
A gateway is the front door. Typical responsibilities:
Concern | Example |
|---|---|
Routing |
|
Authentication | Validate OAuth/OIDC tokens, API keys for partners |
Rate limiting and quotas | 100 requests per minute per API key |
Request shaping | Header rewrites, path rewrites, CORS |
TLS termination | Public certificates, HTTP/2 and HTTP/3 to clients |
API product features | Developer portal, usage plans, monetisation |
Options range from cloud-managed (AWS API Gateway, Google Cloud API Gateway or Apigee, Azure API Management) to self-hosted (Kong, Envoy Gateway, NGINX, Traefik). On Kubernetes, the Gateway API (Gateway, HTTPRoute, GRPCRoute) is now the standard way to describe edge routing, replacing much of what Ingress annotations used to do. If you still run ingress-nginx, our migration notes are in post 151.
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: orders
spec:
parentRefs:
- name: public-gateway
hostnames: ["api.example.com"]
rules:
- matches:
- path: { type: PathPrefix, value: /orders }
backendRefs:
- name: orders
port: 8080
What a gateway does not do: it does not see a call from orders to billing, because that call never passes through it.
What a service mesh does
A mesh puts a proxy on the path of every service-to-service call, plus a control plane that configures those proxies. Common features:
Concern | What the mesh gives you |
|---|---|
Mutual TLS | Every call encrypted and both sides authenticated, with automatic certificate rotation |
Identity-based authorisation | "Only |
Traffic policy | Retries, timeouts, circuit breaking, outlier detection |
Traffic splitting | Canary by percentage, header-based routing between versions |
Telemetry | Uniform request metrics and traces for every hop, without code changes |
The main open-source meshes are Istio and Linkerd, with Cilium offering mesh features from its eBPF data path. Istio supports two data plane modes: the classic sidecar (an Envoy proxy in every pod) and ambient mode, which went GA in Istio 1.24 and uses a per-node ztunnel for mTLS plus optional per-namespace waypoint proxies for Layer 7 policy.
Where they overlap
Both can terminate TLS, retry, time out, split traffic and emit metrics. The overlap is why the choice feels confusing. A useful rule:
Policy about who outside may call you and how much belongs at the gateway.
Policy about which of your services may call which, and how they behave under failure belongs in the mesh or in client libraries.
Many teams run both: a gateway at the edge and a mesh inside, sometimes from the same vendor, with the mesh's ingress gateway acting as the API gateway.
What a mesh really costs
The marketing focuses on features. Operating cost is what decides whether it was worth it.
Cost | Sidecar mode | Ambient mode |
|---|---|---|
Extra memory and CPU | Proxy per pod; adds up with hundreds of pods | One ztunnel per node, waypoints only where L7 is needed |
Latency | Two proxy hops per call | Lower for L4-only traffic; L7 adds waypoint hop |
Upgrades | Restart every workload to update sidecars | Node-level components upgraded separately |
Debugging | New failure modes: proxy config, certificate, xDS sync | Same, plus new components to learn |
Team knowledge | Someone must understand Envoy config and the control plane | Same |
Startup ordering | App can start before the sidecar is ready | Not an issue for ztunnel |
The hidden cost is people. Somebody has to own mesh upgrades, read proxy logs at 3 a.m. and explain why a 503 UF is not the application's fault. If no team can own that, the mesh becomes the thing everyone blames during incidents.
How far you get with neither
For a small number of services, you can get most of the value with simpler tools:
Need | Without a mesh |
|---|---|
Encryption in transit | CNI with transparent encryption (WireGuard or IPsec in Cilium/Calico) or TLS in the app |
Service identity | Signed service tokens or mTLS from a shared library (see post 650) |
Retries and timeouts | A standard HTTP client wrapper with deadlines and retry budgets |
Circuit breaking | Resilience libraries (resilience4j, Polly, failsafe) |
Telemetry | OpenTelemetry SDK with auto-instrumentation |
Network isolation | Kubernetes NetworkPolicy, default deny |
The cost here is consistency across languages. If you run Java, Go, Python and Node services, you need four client wrappers that behave the same way. That is the point where a mesh starts to pay off.
A staged path
Start with a gateway for anything public. Centralise authentication, rate limits and TLS there.
Add NetworkPolicy with default deny so services can only reach what they need.
Standardise a client library per language with timeouts, retry budgets and OpenTelemetry.
Measure the gaps: compliance asking for mTLS everywhere, too many languages to keep libraries aligned, canary needs your deploy tool cannot meet.
Adopt a mesh for one namespace first. With Istio ambient you can enrol a namespace with a label and start at L4 mTLS only:
kubectl label namespace payments istio.io/dataplane-mode=ambient
Add L7 policy only where needed (a waypoint for the namespace that needs header-based routing or per-path authorisation).
Decision table
Situation | Recommendation |
|---|---|
Public API, few services, one or two languages | Gateway only, libraries for resilience |
Compliance requires mTLS between all services | Mesh (ambient or Linkerd) or CNI encryption plus app identity |
Many languages, inconsistent retries and timeouts | Mesh for uniform traffic policy |
Frequent canaries and traffic shifting between versions | Mesh or a progressive delivery tool on top of Gateway API |
No team to own platform components | Avoid a mesh until you have one |
Partners need API keys, quotas, portal | Managed API gateway or API management product |
Common mistakes
Mistake | Why it hurts | Do this instead |
|---|---|---|
Using the gateway for internal calls | Extra hop, single choke point, hairpin traffic | Call services directly or through the mesh |
Retrying in both app and mesh | Retries multiply: 3 x 3 = 9 attempts per call | Pick one layer for retries |
Installing a mesh to fix one bug | Big platform change for a local problem | Fix the client, revisit later |
Mesh without ownership | Proxy issues become everyone's mystery | Assign a platform owner before rollout |
Ignoring sidecar startup order | App calls fail before proxy is ready | Native sidecar containers or ambient mode |
Key takeaways
Gateway equals north-south front door; mesh equals east-west traffic between your services.
They overlap on TLS, retries and metrics; choose one layer per concern to avoid double retries.
A mesh's biggest cost is operational ownership, not CPU.
With few services and few languages, NetworkPolicy, a client library and OpenTelemetry go a long way.
Ambient-style meshes lower the per-pod cost; still start with one namespace.
References
Kubernetes Gateway API: https://gateway-api.sigs.k8s.io/
Istio, Ambient mode overview: https://istio.io/latest/docs/ambient/overview/
Istio, Sidecar or ambient: https://istio.io/latest/docs/overview/dataplane-modes/
Linkerd documentation: https://linkerd.io/2-edge/overview/
Kubernetes, Network Policies: https://kubernetes.io/docs/concepts/services-networking/network-policies/
Comments
0No comments yet. Be the first to comment!
Sign In to post a comment.