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: canary

Then test:

$ curl -H 'x-canary-user: true' https://app.example.com/checkout

Preparing for an interview?

Check 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

← All Istio & Service Mesh questions