VirtualService:目标服务的一组规则

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: prometheus-vs
  namespace: istio-system
spec:
  hosts:
  - "prometheus.local"
  gateways:
  - istio-system/gateway-prometheus
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: prometheus
        port:
          number: 9090

hosts:几种使用方法

hosts: abc.com
hosts: 192.168.1.140
hosts: forecast
hosts: forecast.weather.svc.cluster.local # 这里的weather是virtualService的namespace而不是Service的namespace

gateways:

        作用方式:网格里的Sidecar、入口处的Gateway

        网格内:省略gateways字段

        网格外:配置gateways字段

        网格内核网格外:配置gateways字段和mesh常量

http: