<p>As I understand, Istio <code>VirtualService</code> is kind of abstract thing, which tries to add an interface to the actual implementation like the service in Kubernetes or something similar in Consul.</p>
<p>When use Kubernetes as the underlying platform for Istio, is there any difference between Istio <code>VirtualService</code> and Kubernetes <code>Service</code> or are they the same?</p>

koly
<h3>Kubernetes service</h3>
<p>Kubernetes <code>service</code> manage a pod's networking. It specifies whether your pods are exposed internally (<code>ClusterIP</code>), externally (<code>NodePort</code> or <code>LoadBalancer</code>) or as a CNAME of other DNS entries (<code>externalName</code>).</p>
<p>As an example this <code>foo-service</code> will expose the pods with label <code>app: foo</code>.  Any requests sent to the node on port <code>30007</code> will be forwarded to the pod on port <code>80</code>.</p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: foo-service
spec:
  type: NodePort
  selector:
    app: foo
  ports:
    - port: 80
      targetPort: 80
      nodePort: 30007
</code></pre>
<h3>Istio virtualservice</h3>
<p>Istio <code>virtualservice</code> is one level higher than Kuberenetes <code>service</code>. It can be used to apply traffic routing, fault injection, retries and many other configurations to <code>services</code>.</p>
<p>As an example this <code>foo-retry-virtualservice</code> will retry 3 times with a timeout 2s each for failed requests to <code>foo</code>.</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: foo-retry-virtualservice
spec:
  hosts:
  - foo
  http:
  - route:
    - destination:
        host: foo
    retries:
      attempts: 3
      perTryTimeout: 2s
</code></pre>
<p>Another example of this <code>foo-delay-virtualservice</code> will apply a 0.5s delay to 0.1% of requests to <code>foo</code>.</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: foo-delay-virtualservice
spec:
  hosts:
  - foo
  http:
  - fault:
      delay:
        percentage:
          value: 0.1
        fixedDelay: 5s
    route:
    - destination:
        host: foo
</code></pre>
<h3>Ref</h3>
<p><a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="noreferrer">https://kubernetes.io/docs/concepts/services-networking/service/</a>
<a href="https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/" rel="noreferrer">https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/</a>
<a href="https://istio.io/latest/docs/reference/config/networking/virtual-service/" rel="noreferrer">https://istio.io/latest/docs/reference/config/networking/virtual-service/</a>
<a href="https://istio.io/latest/docs/concepts/traffic-management/#virtual-services" rel="noreferrer">https://istio.io/latest/docs/concepts/traffic-management/#virtual-services</a></p>
