Istio virtualservice uri match not working

11/20/2019

I am new to kubernetes and istio. On GKE, I have created ingress-gateway and two virtual services. The first one is frontend-gateway that routes to hipstershop and the second one is dummyservice which route to my hello world server. But when I call with

curl -v http://35.223.232.224/dummy

, it shows Cannot GET /dummy error.I'm sure my dummyservice is working since I have tested with Loadbalancer external IP.But I can call to hipstershop with http://ingress_ip. Can someone please help me?

Here is my istio config file

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: frontend-gateway
spec:
  selector:
    istio: ingressgateway # use Istio default gateway implementation
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: dummy-ingress
spec:
  hosts:
  - "*"
  gateways:
  - frontend-gateway                
  http:
  - match:
    - uri:
        exact: /dummy
    route:
    - destination:
        host: dummyservice            
        port:
          number: 80

---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: dummy-ingress2
spec:
  hosts:
  - "*"
  gateways:
  - frontend-gateway                
  http:
  - match:
    - uri:
        exact: /dummy2
    route:
    - destination:
        host: dummyservice            
        port:
          number: 80

---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: frontend-ingress
spec:
  hosts:
  - "*"
  gateways:
  - frontend-gateway
  http:
  - route:
    - destination:
        host: frontend
        port:
          number: 80
-- Min Htet Oo
google-kubernetes-engine
istio
kubernetes-ingress

2 Answers

11/22/2019

FYI : Kaili and Jaeger can be installed with Istio and can give you information about traffic in your service mesh

-- Peter Claes
Source: StackOverflow

11/20/2019

My dummyservice node.js server is only serving on "/" url. So the error 404 returning is not from ingress but from my node.js server.Changing my base route in node server solved the issue.

'use strict';

const express = require('express');

// Constants
const PORT = 80;
const HOST = '0.0.0.0';

// App
const app = express();
app.get('/dummy', (req, res) => {
  res.send('Hello world\n');
});

app.listen(PORT, HOST);
console.log(`Running on http://${HOST}:${PORT}`);
-- Min Htet Oo
Source: StackOverflow