GET HTTP/1.1" 404 - via_upstream

Hello,

I am new to service mesh with istio. to test and have some hands on, I decided to use istio for a simple example containing a front and back end.

I have first deployed both front and back with deployements and services, everything went good. but when applying istio (deployed gateway and virtualservice) I am getting this when trying to curl to the istio ingress “/home” path:

 <!DOCTYPE html>
            <html lang="en">
            <head>
            <meta charset="utf-8">
            <title>Error</title>
            </head>
            <body>
            <pre>Cannot GET /home</pre>
            </body>
            </html>

The logs of the ingress show this

[2022-06-08T15:26:39.103Z] "GET /home HTTP/1.1" 404 - via_upstream - "-" 0 143 2 2 "10.2.0.5" "curl/7.68.0" "7208ed17-a049-9090-8b80-07406bf3f67c" "10.107.240.20" "10.0.1.22:5000" outbound|80||myapp-back-sv.myapp.svc.cluster.local 10.0.1.27:56612 10.0.1.27:8080 10.2.0.5:55445 - -

where 10.0.1.22:5000 is the endpoint of the service I want to reach with ingress.

azureuser@worker-node1:~$ kubectl describe svc istio-ingressgateway -n istio-system
Name:                     istio-ingressgateway
Namespace:                istio-system
Labels:                   app=istio-ingressgateway
                          install.operator.istio.io/owning-resource=unknown
                          install.operator.istio.io/owning-resource-namespace=istio-system
                          istio=ingressgateway
                          istio.io/rev=default
                          operator.istio.io/component=IngressGateways
                          operator.istio.io/managed=Reconcile
                          operator.istio.io/version=1.14.0
                          release=istio
Annotations:              <none>
Selector:                 app=istio-ingressgateway,istio=ingressgateway
Type:                     LoadBalancer
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.107.240.20
IPs:                      10.107.240.20
Port:                     status-port  15021/TCP
TargetPort:               15021/TCP
NodePort:                 status-port  30615/TCP
Endpoints:                10.0.1.27:15021
Port:                     http2  80/TCP
TargetPort:               8080/TCP
NodePort:                 http2  32390/TCP
Endpoints:                10.0.1.27:8080
Port:                     https  443/TCP
TargetPort:               8443/TCP
NodePort:                 https  30844/TCP
Endpoints:                10.0.1.27:8443
Port:                     tcp  31400/TCP
TargetPort:               31400/TCP
NodePort:                 tcp  30051/TCP
Endpoints:                10.0.1.27:31400
Port:                     tls  15443/TCP
TargetPort:               15443/TCP
NodePort:                 tls  31070/TCP
Endpoints:                10.0.1.27:15443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

Here is my istio manifests :

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: myapp-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: myapp-vs
spec:
  hosts:
  - "*"
  gateways:
  - myapp-gateway
  http:
  - match:
    - uri:
        exact: /home
    - uri:
        exact: /home/

        # - uri:
        #prefix: "*"
    route:
    - destination:
        host: myapp-back-sv
        port:
          number: 80

Any idea what I did wrong ?

Istio automatically inject sidecar, I doubt the myapp-back-sv namespace is labelled
kubectl label namespace ** istio-injected=enabled