

app in the frontend namespace. This is the workload the VirtualService will route to.
app: app. In production you should choose clear, consistent labels for maintainability.
A simple VirtualService for this workload might look like this. It is created in the same namespace (frontend) and targets the Kubernetes Service app-svc. The http block contains match rules and routes to your destination service.
match entry; it is shown here to illustrate what you can include. At the bottom of the rule, route forwards traffic to the Kubernetes Service destination.
You can add multiple matches and even rewrite the URI. For example, requests to /login can be rewritten to / before being forwarded to the backend:
- Fine-grained L7 routing based on headers, URIs, query parameters, and more.
- Traffic splitting for canary releases and A/B testing (weighted routing).
- Mirroring (shadowing) traffic for testing.
- Fault injection for resilience testing.
- Retries, timeouts, and advanced retry policies.
- URL rewrites and redirects.
- Advanced load balancing (round-robin, least connections, weighted routing).


Important: VirtualServices only take effect when traffic passes through the Envoy sidecar proxy. If the target namespace does not have Istio sidecar injection enabled or a sidecar proxy is not injected into the pod, the VirtualService routing will not be applied.
If a namespace is not Istio-enabled (no sidecar proxy), a VirtualService will not have any effect. Ensure sidecar injection is enabled or that the workload includes the Envoy sidecar. See Istio sidecar injection docs: https://istio.io/latest/docs/setup/additional-setup/sidecar-injection/
- Istio VirtualService reference: https://istio.io/latest/docs/reference/config/networking/virtual-service/
Traffic management and VirtualServices are heavily tested topics on the Istio certification. Spend time practicing match conditions, routing rules, rewrites, retries, and fault injection scenarios. Many exam tasks involve creating or troubleshooting VirtualServices.