<p>I have been trying to run a local cluster on kubernetes and istio on macOS using Docker desktop. I used the bookinfo example and everything runs fine.</p>
<p>I have one of my own service and I am unable to get it to run. I try to hit it using postman and always get a 404.</p>
<p>I am unable to debug it, I might just be missing something or doing something stupid.
These are my yaml files</p>
<p><strong>gateway.yaml</strong></p>
<pre><code>apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: reeal-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: reeal
spec:
  hosts:
  - &quot;*&quot;
  gateways:
  - reeal-gateway
  http:
  - match:
    - uri:
        exact: /feed
    route:
    - destination:
        host: feed
        port:
          number: 8080
</code></pre>
<p><strong>service.yaml</strong></p>
<pre><code>apiVersion: v1
kind: Service
metadata:
  name: feed
  labels:
    app: feed
    service: feed
spec:
  selector:
    app: feed
  ports:
    - port: 8080
      name: http
---
 apiVersion: v1
 kind: ServiceAccount
 metadata:
  name: reeal-feed
  labels:
    account: feed
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: feed-deployment
  labels:
    app: feed
    version: v1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: feed
      version: v1
  template:
    metadata:
      labels:
        app: feed
        version: v1
    spec:
      serviceAccountName: reeal-feed
      volumes:
      - name: firestore-key
        secret:
          secretName: firestore-cred
      containers:
      - name: feed-service
        image: reealadmin/feed-service:latest
        imagePullPolicy: Always
        ports:
        - containerPort: 8080
        volumeMounts:
        - name: firestore-key
          mountPath: /var/secrets/google
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/key.json
      imagePullSecrets:
        - name: regcred
</code></pre>
<p>I have tested the service by exposing it using Nodeport and i can curl and get the respective response, however I am making some mistake to not be able to configure the ingress properly.</p>
<p><strong>URL</strong></p>
<p>I am using below for my URL. The url formed is <code>localhost/feed</code></p>
<pre><code>export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name==&quot;http2&quot;)].port}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name==&quot;https&quot;)].port}')


export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].hostname}')

echo $INGRESS_HOST
echo $INGRESS_PORT
echo $SECURE_INGRESS_PORT
</code></pre>
<p><strong>ERROR</strong></p>
<pre><code>[2020-08-22T01:01:05.088Z] &quot;GET /feed HTTP/1.1&quot; 404 - &quot;-&quot; &quot;-&quot; 0 19 29 22 &quot;192.168.65.3&quot; &quot;PostmanRuntime/7.26.3&quot; &quot;e5705c53-6e70-9dbe-b831-764f9c7be63e&quot; &quot;localhost&quot; &quot;10.1.0.41:8080&quot; outbound|8080||feed.default.svc.cluster.local 10.1.0.25:40654 10.1.0.25:8080 192.168.65.3:59050 - -
</code></pre>
<p>Really need help here.</p>

<p>If you get 404 error, this means that your application is reached but does not have a <code>/feed</code> page.</p>
<p>You either can change your app to serve all content on that contextPath or do a rewrite on your VirtualService:</p>
<pre><code>http:
  - match:
    - uri:
        exact: /feed
    rewrite:
      uri: /
    route:
    - destination:
        host: feed
        port:
          number: 8080
</code></pre>
