<p>I am trying to work on sample project for istio. I have two apps demo1 and demo2.</p>
<p>demoapp Yml</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-1-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo-1-app
  template:
    metadata:
      labels:
        app: demo-1-app
    spec:
      containers:
        - name: demo-1-app
          image: muzimil:demo-1
          ports:
            - containerPort: 8080
          imagePullPolicy: Never
---

apiVersion: v1
kind: Service
metadata:
  name: demo-1-app
spec:
  selector:
    app: demo-1-app
  ports:
    - port: 8080
      name: http

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: demo-1-app
  labels:
    account: demo-1-app
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: demo-2-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: demo-2-app
  template:
    metadata:
      labels:
        app: demo-2-app
    spec:
      containers:
        - name: demo-2-app
          image: muzimil:demo2-1
          ports:
            - containerPort: 8080
          imagePullPolicy: Never
---

apiVersion: v1
kind: Service
metadata:
  name: demo-2-app
spec:
  selector:
    app: demo-2-app
  ports:
    - port: 8080
      name: http

---

apiVersion: v1
kind: ServiceAccount
metadata:
  name: demo-2-app
  labels:
    account: demo-2-app
</code></pre>
<p>And My gateway os this</p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: demo-app-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - &quot;*&quot;
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: demo-service1
spec:
  hosts:
  - &quot;*&quot;
  gateways:
  - demo-app-gateway
  http:
  - match:
    - uri:
        exact: /demo1
    route:
    - destination:
        host: demo-1-app
        port:
          number: 8080
  - match:
    - uri:
        exact: /demo2
    route:
    - destination:
        host: demo-2-app
        port:
          number: 8080
</code></pre>
<p>I tried to hit url with localhost/demo1/getDetails both 127.0.0.1/demo1/getDetails</p>
<p>But I am getting always 404</p>
<p>istioctl analyse does not give any errors.</p>

Patan
<p>To access the application - either change istio-ingressgateway service to NodePort or do port forwarding for the istio ingress gateway service.  Edit the istio-ingressgateway service to change the service type.</p>
<pre><code>type: NodePort
</code></pre>
<p>K8s will give a node port then you can provide the same nodeport values in istio gateway.</p>
<pre><code>  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: &lt;nodeportnumber&gt;
      name: http
      protocol: HTTP
</code></pre>
