Egress Gateway: Control Your Mesh's Outbound Traffic

An Egress Gateway is a monitored exit door for all outbound traffic from your service mesh. Use it to enforce security on external calls, like restricting domains or originating mTLS.
Why it exists
In a zero-trust network, you control service-to-service traffic. But what about traffic leaving the mesh to external APIs? Without a central control point, any service can call any external endpoint, creating security holes and making auditing impossible. An Egress Gateway solves this by funneling all outbound traffic through a single, manageable exit point.
The mental model
Think of an Egress Gateway as the single, secured loading dock for a large factory (your service mesh). Instead of every workshop shipping its own packages out any available window, all outbound shipments are routed through the loading dock. There, security can inspect them, log them, and ensure they're going only to approved destinations.
How it works
You deploy a dedicated Envoy proxy as a gateway at the edge of your mesh. You then use Istio resources to direct outbound traffic from your services to this gateway. A ServiceEntry defines an external service, making it known to the mesh. A Gateway resource configures the egress gateway pod itself (ports, protocols). Finally, a VirtualService binds to the ServiceEntry and routes the traffic through the configured Gateway. This allows the gateway to apply policies like timeouts, retries, and TLS origination on behalf of the internal services.
When to use it
Use an Egress Gateway when you need to enforce consistent policy on traffic leaving the mesh. This is crucial for security compliance, like limiting egress to an allow-list of external domains. It's also useful for monitoring all outbound traffic in one place or for originating mTLS connections to external services when your internal applications can't handle it themselves.
When not to use it
For simple setups where outbound traffic control isn't a security or operational requirement, an egress gateway adds complexity and an extra network hop. If your cluster's default network policies (like Kubernetes NetworkPolicy) are sufficient for your egress control needs, you might not need an Istio Egress Gateway.
One canonical example
A common use case is forcing all traffic to an external API, like api.partner.com, to go through the egress gateway. You would create a ServiceEntry for api.partner.com. Then, you'd configure a VirtualService to route requests for this host through the egress gateway. This ensures that even if a pod is compromised, it can't exfiltrate data to arbitrary endpoints, only to the explicitly allowed external services routed through the gateway.
Interview question
What is the primary reason to implement an Istio Egress Gateway in a service mesh?
- a.To manage and secure all incoming traffic from external clients to services within the mesh.
- b.To eliminate the need for Kubernetes NetworkPolicies by handling all network segmentation.
- c.To enforce consistent security policies and gain centralized control over traffic leaving the mesh.Correct
- d.To optimize the routing and load balancing of traffic between services residing inside the mesh.
Why? this is the answer
An Egress Gateway's core purpose is to funnel all outbound traffic from the mesh through a single point, enabling consistent policy enforcement, security compliance, and centralized monitoring. Option B is incorrect because the card states that if Kubernetes NetworkPolicies are sufficient for egress control, an Egress Gateway might not be needed, indicating it doesn't universally replace them for all network segmentation.
Just read this? Test yourself on what you have been reading.
Read the original → istio.io
- #istio
- #service mesh
- #kubernetes
- #networking
Put your scrolling time to good use
Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles