Interview › Istio & Service Mesh
How does Istio do request routing based on headers or paths?
Istio & Service Mesh · Basic level
Answer
Istio routes by matching request attributes in a VirtualService. For HTTP traffic, it can match URI prefixes or exact paths, methods, headers, query parameters, gateways, ports, and source labels, then route to a destination subset or service.
Technical explanation
Header-based routing is useful for internal testers, beta users, or requests carrying a specific release header.
Path-based routing is common at ingress gateways for routing /api, /admin, or /static to different backends.
Match rules are evaluated in order, so specific rules should come before general catch-all routes.
Hands-on example
Header route example:
match:
- headers:
x-canary-user:
exact: 'true'
route:
- destination:
host: checkout
subset: canaryThen test:
$ curl -H 'x-canary-user: true' https://app.example.com/checkoutCheck how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Istio & Service Mesh interview questions
- What are subsets in a DestinationRule, and how are they used?
- What is fault injection in Istio, and why would you use it?
- How do you implement a blue-green deployment using Istio?
- How do you inject delays or aborts to test resilience with Istio?
- How do you do weighted traffic splitting for a canary release in Istio?
- What are timeouts in Istio, and how do they interact with retries?
- What is the difference between an Istio ingress gateway and an egress gateway?
- What is outlier detection, and how does it eject unhealthy hosts?