I am watching a Pluralsight video on the Istio service mesh. One part of the presentation says this:
The VirtualService uses the Kubernetes service to find the IP addresses of all the pods. The VirtualService doesn't route any traffic through the [Kubernetes] service, but it just uses it to get the list of endpoints where the traffic could go.
And it shows this graphic (to show the pod discovery, not for traffic routing):
I am a bit confused by this because I don't know how an Istio VirtualService
knows which Kubernetes Service
to look at. I don't see any reference in the example Istio VirtualService
yaml files to a Kubernetes Service
.
I have theorized that the DestinationRules
could have enough labels on them to get down to just the needed pods, but the examples only use the labels v1
and v2
. It seems unlikely that a version alone will give only the needed pods. (Many different Services
could be on v1
or v2
.)
How does an Istio VirtualService
know which Kubernetes Service
to associate to?
or said another way,
How does an Istio VirtualService
know how to find the correct pods from all the pods in the cluster?