Istio VirtualService always 404s

9/16/2019

I've had a single VirtualService running through a simple http Gateway and everything works fine:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: satc-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: report
spec:
  hosts:
  - report-create.default.svc.cluster.local
  gateways:
  - satc-gateway
  http:
  - match:
    - uri:
      prefix: /v1/report
    route:
    - destination:
        host: report-create
        port:
          number: 8080

I have since added a second VirtualService for a the second service in the cluster through the same Gateway

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: routing
spec:
  hosts:
  - routing-svc.default.svc.cluster.local
  gateways:
  - satc-gateway
  http:
  - match:
    - uri:
        prefix: /v1/routing
    route:
    - destination:
        host: routing-svc.default.svc.cluster.local
        port:
          protcol: http
          number: 8080

Whilst the first VirtualService still seems to serve, the second consistently 404s. I have added a simple endpoint "/v1/routing/test" to return a Hello World message to ensure the issue doesn't spawn from application logic.

Both VirtualServices seem to be running as expected, though only requests to report are returning anything other than a 404:

report    [satc-gateway]   [report-create.default.svc.cluster.local]   2h
routing   [satc-gateway]   [routing-svc.default.svc.cluster.local]     18m

I have tried removing the first deployment all together to ensure it is now hoovering up all the traffic coming in to the cluster and still get 404s. I've also tried executing the routes from inside the pod with a successful response, both services use container port 8080 which I have also triple checked.

I seem to have hit a bit of a wall with this, unsure what is the next best steps in order to debug correctly.

-- GaryDevenay
istio
kubernetes
kubernetes-ingress

1 Answer

9/27/2019

I have analyzed both your yamls and found few issues regarding the second one:

  • there are 2 extra spaces in the prefix: line
  • there is a typo in the 'protocol:' line (missed an o)
  • there are some differences in the destination: part

Please make the adjustments and let me know if that helped.

-- OhHiMark
Source: StackOverflow