Should we define VirtualService if it is just a plain proxy to Service?

12/11/2018

I have the following VirtualService whose hosts mapping (backend) is just the same as host destination (backend). I think it's redundant since we can access the K8S Service directly.

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: backend
  namespace: default
spec:
  hosts:
  - backend
  http:
  - route:
    - destination:
        host: backend

Is my understanding correct? If not, is it better practice to define VirtualService for each Service?

-- Pahlevi Fikri Auliya
istio
kubernetes

1 Answer

12/12/2018

You are correct that your virtual service is redundant and not needed. It is, however, best practice to define virtual services for your services right from the start, especially if you plan to use istio traffic management features in the future. This is mentioned in the last paragraph of this section of the docs.

-- Frank B
Source: StackOverflow