Skip to content

Istio VirtualService

An Istio VirtualService is a core resource within the Istio service mesh used to configure how requests are routed to services. It defines a set of traffic routing rules that allow control over request flow, such as splitting traffic across different versions of a service or forwarding requests to specific subsets of service instances.^[README.md]

Configuration and Deployment

VirtualServices are often applied alongside a Istio Gateway to manage Ingress traffic. For example, to support upgraded connections like WebSockets for incoming traffic, a VirtualService is created in conjunction with a Gateway resource^[README.md]. The application deployment typically involves creating a Kubernetes Service and Deployment, followed by applying the VirtualService configuration^[README.md].

Installation Example

The application is usually deployed first, potentially using sidecar injection (either manual via istioctl or automatic). Once the application pods are running, the VirtualService and Gateway configurations are applied to establish the traffic rules^[README.md].

WebSocket Support

A specific use case for a VirtualService is enabling WebSocket upgrades. Standard routing rules may not support protocol upgrades like WebSocket by default; specific configuration versions (such as v1alpha3 routing rules post-Istio v0.8.0) are required to handle these connections correctly^[README.md].

When configured correctly, the VirtualService allows the Ingress gateway to accept traffic that requires a connection upgrade. The successful establishment of these rules can be verified by accessing the service via the Ingress Gateway IP and confirming the connection status (e.g., a green "open" status in a demo application)[^[README.md]].

Sources

  • README.md