<p>We switch now to <strong>istio</strong> and I need to expose my app to outside</p>
<p>In the app, I've only 3 routes</p>
<blockquote>
<ol>
<li>&quot;/&quot; root route</li>
<li>&quot;/login&quot;</li>
<li>&quot;static&quot;  - my app should serve some static files</li>
</ol>
</blockquote>
<p>we have <code>gw</code> and <code>host</code> but somehow I cannot access my app, any idea what am I doing wrong here?
<strong>vs-yaml</strong></p>
<p>is there a way to expose all the routes, or should I define them explicitly, if so how as it a bit confusing with <code>routes</code> and <code>match</code>?</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bher-virtualservice
  namespace: ba-trail
spec:
  gateways:
    - webb-system.svc.cluster.local
  hosts:
    - trialio.cloud.str
  http:
    - route:
        - destination:
            host: bsa
            port:
              number: 5000
</code></pre>

Jenny M
<blockquote>
<p>if so how as it a bit confusing with routes and match</p>
</blockquote>
<p>I would suggest to take a look at istio documentation about <a href="https://istio.io/latest/docs/reference/config/networking/virtual-service/" rel="nofollow noreferrer">virtual services</a>, it's well described there.</p>
<hr />
<p>Let's start from the beginning, you have virtual service and gateway, they should be in the same namespace as your application, or you need to specify that in both of them.</p>
<p>As far as I can see your virtual service is incorrect, I have prepared example which should work for you. Take a look at below example.</p>
<p><strong>Gateway</strong></p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: bher-gateway
  namespace: ba-trail 👈
spec:
  selector:
    istio: ingressgateway # use the default IngressGateway
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - &quot;trialio.cloud.str&quot;
</code></pre>
<p>I see you have <a href="https://istio.io/docs/reference/config/networking/gateway/" rel="nofollow noreferrer">gateway</a> which is already deployed, if it´s not in the same namespace as virtual service, you should add it like in below example.</p>
<p>Check the <code>spec.gateways</code> section</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
name: my-gateway
namespace: some-config-namespace
</code></pre>
<hr />
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bookinfo-Mongo
  namespace: bookinfo-namespace
spec:
  gateways:
  - some-config-namespace/my-gateway # can omit the namespace if gateway is in same
                                       namespace as virtual service.
</code></pre>
<hr />
<p><strong>Virtual service</strong></p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: bher-virtualservice
  namespace: ba-trail 👈
spec:
  gateways:
    - bher-gateway 👈  // name of your gateway 
  hosts:
    - trialio.cloud.str
  http:
    - match:
      - uri:
          prefix: &quot;/&quot;
      - uri:
          prefix: &quot;/login&quot;
      - uri:
          prefix: &quot;/static&quot;
      - uri:
          regex: '^.*\.(ico|png|jpg)$'
      route:
      - destination:
          host: bsa.ba-trail.svc.cluster.local 👈  // name_of_your service.namespace.svc.cluster.local
          port:
            number: 5000
</code></pre>
<p>Take a look at this <a href="https://rinormaloku.com/istio-practice-routing-virtualservices/" rel="nofollow noreferrer">example</a></p>
<blockquote>
<p>Let’s break down the requests that should be routed to Frontend:</p>
<p><strong>Exact path</strong> / should be routed to Frontend to get the Index.html</p>
<p><strong>Prefix path</strong> /static/* should be routed to Frontend to get any static files needed by the frontend, like <strong>Cascading Style Sheets</strong> and <strong>JavaScript files</strong>.</p>
<p><strong>Paths matching the regex ^.*.(ico|png|jpg)$</strong> should be routed to Frontend as it is an image, that the page needs to show.</p>
</blockquote>
<pre><code>http:
  - match:
    - uri:
        exact: /
    - uri:
        exact: /callback
    - uri:
        prefix: /static
    - uri:
        regex: '^.*\.(ico|png|jpg)$'
    route:
    - destination:
        host: frontend             
        port:
          number: 80
</code></pre>
<hr />
<p>Hope you find this useful. If you have any questions let me know in the comments.</p>
