Skip to content
Tutorials Center
My learning

Topics

Lesson 6 of 36 ยท Service Mesh Concepts

Mesh, Libraries and Gateways Compared

Compare a service mesh with client libraries, Kubernetes Services, Ingress and API gateways, and with other meshes, so you can decide what you really need.

"Do I need a service mesh?" is really "which layer should own this concern?" The same problem (retries, authentication, rate limiting) can live in a library, in a gateway, in Kubernetes, or in a mesh. This lesson compares the options so you pick on purpose rather than by fashion.

The options, side by side

Layer Handles Scope Cost
Client library (Resilience4j, Polly, gRPC options) Retries, timeouts, circuit breaking One language Code in every service
Kubernetes Service + kube-proxy Discovery, round-robin In-cluster L4 None
NetworkPolicy IP/port allow rules L3/L4 CNI support
Ingress / Gateway API Edge routing, TLS termination North-south traffic One controller
API gateway Auth, rate limits, API products Public APIs Gateway to run
Service mesh Mutual TLS, L7 routing, telemetry, policy East-west traffic (and edge) Proxies everywhere

North-south traffic crosses the cluster edge (user to service). East-west traffic stays inside (service to service). Ingress controllers and API gateways are mainly north-south tools; a mesh is mainly an east-west tool, though Istio's gateway can also serve the edge.

Mesh versus library

A library gives you control inside your code and no extra hop. But you must adopt it in every language and keep versions in step; a fix means rebuilding and redeploying every service. A mesh applies the same policy to every language and changes it without a deploy. The trade-off is the extra proxy hop and an operational layer. Some teams use both: a library for business-aware retry decisions, the mesh for transport security and telemetry. Take care that both do not retry the same failing call: two layers with 3 attempts each can multiply to 9.

Mesh versus API gateway

An API gateway manages APIs for outside consumers: API keys, quotas, developer portals, request transformation. A mesh manages calls between your own services. They overlap in routing and token validation, and they work well together: the gateway at the edge, the mesh inside. Istio's own ingress gateway is not an API management product, so billing and developer portals still need something else.

Mesh versus Kubernetes primitives

Kubernetes already gives you Services, health probes and NetworkPolicy. If you only need "pods can find each other and a few ports are closed", that may be enough. Reach for a mesh when you need identity-based policy, encryption without app changes, L7 routing (headers, paths, weights), or consistent telemetry.

Other meshes

Istio is not the only mesh. Briefly, as orientation:

  • Linkerd focuses on simplicity and a lightweight Rust proxy; its feature set is smaller.
  • Consul connects services across Kubernetes and virtual machines with HashiCorp's tooling.
  • Cilium service mesh uses eBPF in the kernel, with an optional Envoy per node.
  • Kuma/Kong Mesh and AWS App Mesh-style products wrap Envoy with their own control planes.

Istio's strengths are the breadth of traffic and security features and a large community; its cost is a larger surface to learn. The concepts in this track (control plane, data plane, mTLS identity, L7 policy) transfer to the others.

A decision helper

This stand-in encodes the rules of thumb above in a function. It is a teaching aid, not an official sizing tool; real decisions also depend on team skills and budget.

Python Stand-in: do you need a mesh?

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Python Stand-in: stacked retries multiply

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Pick one layer to own retries for a given call. A good default is the mesh for transport failures (connection reset, refused) and the application for business failures.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does east-west traffic mean?

    East-west is service-to-service; north-south crosses the cluster edge.
  2. 2. Why can stacking library and mesh retries be dangerous?

    3 attempts in each of two layers can mean 9 calls to a service that is already struggling.
  3. 3. Which need most clearly justifies a mesh over plain NetworkPolicy?

    NetworkPolicy is IP/port based; a mesh can allow a specific service account to call a specific method.
  4. 4. Which pair is a sensible division of labour?

    Gateways serve outside API consumers; the mesh secures and observes calls between your own services.

Summary

  • Choose the layer that should own each concern: library, Kubernetes, gateway or mesh.
  • Meshes shine for east-west mTLS, identity-based policy, L7 routing and uniform telemetry.
  • API gateways and meshes complement each other.
  • Avoid retrying in two layers at once.
  • Linkerd, Consul, Cilium and others share the same core concepts.

Next: Ambient Mode: ztunnel and Waypoints