Interview › Istio & Service Mesh
What is a VirtualService, and what does it control?
Istio & Service Mesh · Basic level
Answer
A VirtualService defines traffic-routing rules for one or more hosts. It controls how requests are matched and routed based on host, URI path, headers, ports, weights, retries, timeouts, fault injection, and mirroring.
Technical explanation
VirtualService is usually paired with DestinationRule when routing to named subsets such as v1 and v2.
It can apply to internal mesh traffic or to traffic entering through a Gateway.
It is a powerful production object, so changes should be reviewed, validated, and rolled out like application code.
Hands-on example
Example route by path:
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
name: reviews
spec:
hosts: [reviews]
http:
- match:
- uri:
prefix: /v2
route:
- destination:
host: reviews
subset: v2
- route:
- destination:
host: reviews
subset: v1Preparing 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
- How does traffic flow through an Envoy sidecar for inbound and outbound requests?
- What is a DestinationRule, and how does it relate to a VirtualService?
- What is a Gateway resource, and how does it differ from a Kubernetes Ingress?
- What is the difference between ztunnel and a waypoint proxy in ambient mode?
- What is the difference between an Istio ingress gateway and an egress gateway?
- What is the Istio ambient (sidecarless) mode, and how does it differ from sidecar mode?
- How does automatic sidecar injection work (namespace label, webhook)?
- How do you do weighted traffic splitting for a canary release in Istio?