title: Istio Virtual Service Relationship to Normal Kubernetes Service
body: <p>I am watching a Pluralsight video on the Istio service mesh.  One part of the presentation says this:</p>
  <blockquote>
  <p>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.</p>
  </blockquote>
  <p>And it shows this graphic (to show the pod discovery, not for traffic routing):</p>
  <p><a href="https://i.stack.imgur.com/I38QT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I38QT.png" alt="VirtualService uses Service to get IPs of pods" /></a></p>
  <p>I am a bit confused by this because I don't know how an Istio <code>VirtualService</code> knows which Kubernetes <code>Service</code> to look at.  I don't see any reference in the example Istio <code>VirtualService</code> yaml files to a Kubernetes <code>Service</code>.</p>
  <p>I have theorized that the <code>DestinationRules</code> could have enough labels on them to get down to just the needed pods, but the examples only use the labels <code>v1</code> and <code>v2</code>.  It seems unlikely that a version alone will give only the needed pods.  (Many different <code>Services</code> could be on <code>v1</code> or <code>v2</code>.)</p>
  <p><strong>How does an Istio <code>VirtualService</code> know which Kubernetes <code>Service</code> to associate to?</strong></p>
  <p>or said another way,</p>
  <p><strong>How does an Istio <code>VirtualService</code> know how to find the correct pods from all the pods in the cluster?</strong></p>