VirtualServices are a core Istio resource that provide L7 (HTTP/gRPC) routing for services running in Kubernetes. They let you define fine-grained routing rules—based on hostnames, paths, headers, or query parameters—and steer requests to specific service versions, enable canary rollouts, mirror traffic, inject faults, and more. A helpful analogy is a university assignment system. Different courses (literature, mathematics, geography, etc.) are taught by different instructors. Students follow a curriculum and need a system that assigns them to the correct classes at the correct times. In this analogy:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- Students = incoming network traffic
- Courses/classes = Kubernetes Services / pods
- VirtualService = the assignment/routing system that decides where each student (request) goes

frontend namespace running image app:1.1, and a corresponding Service to expose it.
app: app (label key app with value app) — this is valid for the example but in production you may prefer more descriptive labels.
Minimal VirtualService
Below is a minimal VirtualService that forwards all HTTP traffic for the app-svc host to the Kubernetes Service endpoint.
/login are rewritten to / before being routed to the service, while all other paths match the root prefix.

- Fine‑grained routing based on HTTP headers, paths, or query parameters
- Traffic splitting between versions for canary or staged rollouts
- A/B testing and blue/green deployments
- Traffic mirroring to duplicate live traffic to a test service
LEAST_CONN, ROUND_ROBIN) and connection-pool settings are configured in a DestinationRule that complements a VirtualService.

VirtualServices are enforced by the Envoy sidecar proxy. If the namespace does not have Istio sidecar injection enabled (i.e., no Envoy sidecars are present), the VirtualService configuration will not take effect.
| Layer | Kubernetes Service | Istio VirtualService |
|---|---|---|
| OSI Layer | L4 (TCP/UDP) | L7 (HTTP/gRPC) |
| Typical responsibilities | Load balancing, service discovery | Path/header-based routing, rewrites, mirroring, fault injection, traffic splitting |
| Configured via | Service resource | VirtualService (plus DestinationRule for policies) |
| Example use | expose pods on port 80 | route /v1 to subset A and /v2 to subset B |
- Most Istio traffic-management features (mirroring, rewrites, fault injection, retries) require a VirtualService for request-level routing.
- Policies like load‑balancing algorithms and connection pool settings live in DestinationRules, which are applied alongside VirtualServices and Envoy configuration.
- VirtualServices operate at the HTTP/gRPC level (L7) and rely on Envoy sidecars to implement configured behaviors.
Many exam and production scenarios require VirtualServices. Review the Istio Traffic Management documentation to practice routing, HTTP match conditions, rewrites, mirroring, fault injection, and retries before applying them in real environments.