<p>I've setup Istio using the helm charts, and I'm trying to expose services to the istio-ingressgateway.</p>

<p>Here's the config I've decided to go with:</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: grafana-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 31400
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: kiali-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 15029
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: prometheus-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 15030
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana-vts
  namespace: istio-system
spec:
  hosts:
  - "*"
  gateways:
  - grafana-gateway
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: grafana.istio-system.svc.cluster.local
        port: 
          number: 3000
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: kiali-vts
  namespace: istio-system
spec:
  hosts:
  - "*"
  gateways:
  - kiali-gateway
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: kiali.istio-system.svc.cluster.local
        port: 
          number: 20001
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: prometheus-vts
  namespace: istio-system
spec:
  hosts:
  - "*"
  gateways:
  - prometheus-gateway
  http:
  - match:
    - uri:
        prefix: /
    route:
    - destination:
        host: prometheus.istio-system.svc.cluster.local
        port: 
          number: 9090
</code></pre>

<p>However - this only routes grafana through ports 31400, 15029 and 15030, while it's supposed to do so just for 31400.</p>

<p>If I'm using just one Gateway and rewrite the uri, it throws up a 404 error/tells me the reverse-proxy isn't setup properly</p>

<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: all-gateway
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: grafana-vts
  namespace: istio-system
spec:
  hosts:
  - "*"
  gateways:
  - all-gateway
  http:
  - match:
    - uri:
        prefix: "/grafana"
      rewrite:
        uri: /
    route:
    - destination:
        host: grafana.istio-system.svc.cluster.local
        port: 
          number: 3000
and etc...
</code></pre>

<p>I'm a bit new to istio, and the examples I've browsed through don't exactly talk about these. If you've got an idea, it'd be swell - is it because of how I've wildcarded the hosts?</p>

JustAnotherThrowaway
<p>Your gateway and virtual services are mixed since the same hosts (<code>*</code>) are used for all of them, so their behavior is undefined in Istio. I would allocate fake hostnames, for example, <code>my-grafana.com</code>, <code>my-kiali.com</code> and use them in the Gateway and Virtual Service definitions. I would add these fake hostnames to the <code>/etc/hosts/</code> file and use them to access Grafana and Kiali from my computer.</p>
