Service Mesh vs API Gateway: What Each One Does

Service Mesh vs API Gateway: What Each One Does

Service mesh vs API gateway is a comparison that confuses many teams, because both sit between services and both manage traffic. The short answer is that an API gateway manages traffic entering your system from outside, while a service mesh manages traffic between your own services inside the system. They answer different questions, they sit in different places, and most mature architectures run both.

The confusion is understandable. Both handle routing, security, rate limiting and observability, and both are often described with the same words. The difference becomes clear once you ask where the traffic is coming from and where it is going. If you want the background on each half of the comparison first, our guide to the service mesh explained covers the mesh side, and the rest of this article covers the gateway side before bringing the two together.

Key takeaways

  • An API gateway is the front door: it manages traffic entering the system from clients outside the cluster.
  • A service mesh is the internal network: it manages traffic between your own services inside the cluster.
  • Gateways handle client concerns such as authentication, API keys, rate limiting and request transformation.
  • Meshes handle service-to-service concerns such as mutual TLS, traffic splitting and golden-signal metrics.
  • Most mature architectures run both, because neither one replaces the other.

What an API gateway does

An API gateway is a single entry point for traffic coming into your system from the outside world. Clients, whether they are web browsers, mobile apps or partner systems, call the gateway, and the gateway routes each request to the right internal service. The client never needs to know how many services exist, where they run or how they are addressed.

The gateway handles the concerns that belong to the boundary. It authenticates callers, checks API keys, enforces rate limits per client, transforms requests and responses, and can aggregate several internal calls into one response for a client that needs data from more than one service. It also produces the metrics that matter at the boundary: which clients are calling, which endpoints are popular, and which callers are hitting their limits. Best for: any public-facing API that needs a single, controlled front door with per-client rules.

What a service mesh does

A service mesh works one layer deeper, on the traffic between your own services. When service A calls service B, the mesh encrypts that call, checks whether A is allowed to call B, decides which version of B should answer, retries the call if it fails, and records how long it took. None of that is visible to the outside client, and none of it is the gateway’s job.

The mesh’s distinctive features are the ones that only make sense between services. Mutual TLS proves the identity of both sides of every internal call, which matters when services trust each other based on cryptographic identity rather than on being inside the same network. Traffic splitting lets a team send a small share of internal calls to a new version of a service, which is how canary releases work behind the gateway. Golden metrics, latency, traffic, errors and saturation, are recorded for every internal call without touching application code. Our guide to service mesh architecture explains the control plane and data plane design that makes all of this work.

Where each one sits

Picture the request path. A client sends a request to the gateway, which sits at the edge of the cluster. The gateway authenticates the client, applies its rate limits, and forwards the request to the first internal service. From there, the mesh takes over: the first service calls a second service through the mesh, the second calls a third, and each hop is encrypted, authorised and measured by the mesh’s proxies.

The gateway sees the request once, at the door. The mesh sees it many times, at every hop inside. That difference in position explains the difference in features. The gateway needs to understand clients, API keys, billing tiers and request shapes, because those are the things that vary at the boundary. The mesh needs to understand services, versions and identities, because those are the things that vary inside.

The comparison, feature by feature

Concern API gateway Service mesh
Position Edge of the cluster, the front door Inside the cluster, beside every service
Traffic it sees Client-to-system, north-south Service-to-service, east-west
Authentication Clients, API keys, tokens Workload identity through mutual TLS
Rate limiting Per client or per API key Per service, usually global or local limits
Routing By path, host or header to a service By version, weight or header between services
Canary releases Possible at the edge, coarse-grained Fine-grained, per service and per version
Observability Client and endpoint metrics Golden metrics for every internal call
Request transformation Yes, a core gateway feature Not a mesh concern

The table shows overlap and difference at the same time. Both do routing and rate limiting, but they do it for different audiences and at different granularity. The overlap is real, and it is the reason some teams think they can choose one and skip the other. The difference is also real, and it is the reason that choice usually comes back to bite them. A gateway cannot see internal calls, so it cannot encrypt them or split them between versions. A mesh cannot see clients, so it cannot bill them or give them API keys.

A laptop showing a layered diagram with one entry gateway above a web of connected services
A gateway guards the front door, while the mesh manages traffic between services.

How they work together

In practice, the two are complementary, and the standard pattern is to run both. The gateway is the only component clients can reach, and it forwards authenticated requests into the mesh. The mesh then handles the internal journey, and the gateway’s job is done once the request is inside. Some gateways, including Istio’s own ingress gateway, are built on the same proxy technology as the mesh, which makes the handover clean: the request passes from a gateway proxy into a mesh proxy with no change in tooling.

The Kubernetes Gateway API is blurring the line further, because it provides a shared configuration language for both ingress and mesh traffic. A team can define routes for the gateway and for the mesh using the same kinds of resources, which reduces the number of configuration styles the platform team has to maintain. The boundary between the two is not disappearing, though. It is becoming easier to configure, which is a different thing from going away.

Common mistakes in choosing

The most common mistake is buying a gateway and expecting it to secure internal traffic. A gateway encrypts the connection from the client to the edge, but once the request is inside the cluster, service-to-service calls travel unencrypted unless a mesh, or some equivalent mechanism, secures them. Teams that assume the gateway covers everything end up with plaintext traffic between services, and they only discover it during a security review.

The opposite mistake is adopting a mesh and expecting it to replace the gateway. A mesh has no concept of a client, no API key management, and no request transformation, so it cannot be the front door. Teams that try end up bolting client-facing features onto the mesh in awkward ways, or running an unprotected entry point while the interior is carefully secured. Our guide to common service mesh problems covers the deployment pitfalls that catch teams out, including the ones that come from expecting one tool to do both jobs.

When you need only a gateway

A team with a small number of services, a simple internal topology and no strict security requirements can often get by with a gateway alone. If services rarely call each other, if the call graph is shallow, and if the main risks are at the boundary rather than inside, then the mesh adds operational cost without adding much value. The gateway handles the client-facing concerns, and the internal traffic is simple enough to leave alone.

That is a legitimate architecture, and it is worth saying so plainly, because the industry sometimes treats the mesh as inevitable. It is not. A gateway-only setup is simpler to run, easier to debug and cheaper to operate, and it is the right answer for many small systems. Best for: small teams with a handful of services and straightforward internal traffic.

When you need only a mesh

A team whose services are never exposed directly to outside clients may need a mesh without a gateway. Internal platforms, batch processing systems and back-office services often have no public API at all, and their traffic is entirely service-to-service. In that case the mesh provides the encryption, authorisation and observability the system needs, and there is no front door to guard.

Even here, the answer is rarely permanent. The moment a partner, a mobile app or a web front end needs access, a gateway becomes necessary, and the team that already has a mesh will add one. The mesh-first starting point is still sound, because the internal controls were the hard part, and the gateway is comparatively easy to add later.

Decision framework: gateway, mesh, or both?

  • Start with a gateway when you have external clients, because a controlled front door is the first requirement.
  • Add a mesh when services call each other often enough that unencrypted, unmeasured internal traffic is a real risk.
  • Run both when you have external clients and a meaningful internal call graph, which is the normal case for a mature system.
  • Choose the gateway first if the budget only stretches to one, because the boundary is where unauthenticated traffic arrives.
  • Choose the mesh first if there are no external clients, because the internal traffic is where the risk actually sits.
  • Do not expect either one to replace the other, because each one sees traffic the other cannot see.
  • Revisit the decision as the system grows, because a gateway-only setup that was right at five services is often wrong at fifty.

Frequently asked questions

Can a service mesh replace an API gateway?

No. A service mesh manages traffic between your own services inside the cluster, while a gateway manages traffic from external clients. The mesh has no concept of a client, no API key management and no request transformation, so it cannot act as the front door.

Can an API gateway replace a service mesh?

Not for internal traffic. A gateway sees each request once, at the edge, and cannot encrypt, authorise or measure the service-to-service calls that happen inside the cluster. Those need a mesh or an equivalent mechanism.

Do I need both a gateway and a mesh?

Most mature systems run both, because the gateway guards the boundary and the mesh secures the interior. Small systems with few services and simple internal traffic can often run a gateway alone, and purely internal systems can run a mesh alone.

What is north-south versus east-west traffic?

North-south traffic flows between clients outside the system and services inside it, and it is the gateway’s territory. East-west traffic flows between services inside the system, and it is the mesh’s territory. The terms come from network diagrams, where external traffic enters from the top and internal traffic moves sideways.

Is Istio’s ingress gateway the same as an API gateway?

Not quite. Istio’s ingress gateway is a proxy at the edge that can route traffic into the mesh, and it can be configured with gateway-like behaviour, but a full API gateway adds client management features such as API keys, developer portals and billing tiers that an ingress gateway does not provide.

How does the Gateway API change this comparison?

The Kubernetes Gateway API provides a shared configuration language for both ingress and mesh traffic, so the same kinds of routing resources can describe the gateway and the mesh. It makes the two easier to configure together, but it does not merge them: the gateway still sits at the edge and the mesh still sits beside every service.

Latest articles

Scroll to Top