1

I have tried to deploy a sample nginx app and it working. So, I replaced the same with another nodejs as this contains mutliple sub pages. So, I can test the routing.

Here, with LoadBalancer default service type, the page is loading as below.

LB

But, with istio gateway, it is just showing an empty page.

gateway

Please suggest how to fix that?

My gateway:

apiVersion: networking.istio.io/v1alpha3
kind: Gateway
metadata:
  name: sampleserver-gateway
spec:
  selector:
    istio: ingressgateway # use istio default controller
  servers:
  - port:
      number: 80
      name: http
      protocol: HTTP
    hosts:
    - "*"

My virtualservice:

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: nginxserver
spec:
  hosts:
  - "*"
  gateways:
  - sampleserver-gateway
  http:
  - match:
    - uri:
        exact: /
    route:
    - destination:
        host: nginx-service
        port:
          number: 8080

My deployment and service file:

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  labels:
    app: nginx
    service: nginx
spec:
  selector:
    app: nginx
  ports:
    - name: http 
      port: 8080
      targetPort: 3000 #80

---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: nginx-details
  labels:
    account: nginx
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  labels:
    app: nginx
    version: v1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nginx
      version: v1
  template:
    metadata:
      labels:
        app: nginx
        version: v1
    spec:
      serviceAccountName: nginx-details
      containers:
        - name: nginx
          image: uday1kiran/getting-started:1.0 #nginx
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 3000 #80
              name: nginx-port
          #securityContext:
              #runAsUser: 1000

For gateway, I set the default kubernetes service as ClusterIP. But, as it is not showing, for testing purpose I changed it to LoadBalancer to check any issue with app, but throug normal LoadBalancer service it is loading but not with istio ingresss gateway.

The sample app is public image, you can test directly

The source code of application is in app folder of repo

uday
  • 257
  • 2
  • 21
  • First image is load balancer service ip. second image is ingress gateway ip. As this is deployed in AKS, i got public ips from microsoft – uday Jul 16 '21 at 14:05
  • Any suggestions on this? I guess internally it is not allowing any page rendering, here in this case it is a react app, which is not getting loaded back. – uday Jul 17 '21 at 18:32
  • There is no reply from the istio discussion forum also : https://discuss.istio.io/t/istio-gateway-not-loading-the-node-application/10945 – uday Jul 17 '21 at 18:41
  • Are you using Consul or Istio? Additionally, have you tried changing http match from "exact" to "prefix"? Also, could you provide the definition of service type Loadbalancer and target ports for both service definitions? – Mikołaj Głodziak Jul 19 '21 at 14:41
  • We are using consul for one product in a different cluster and for a different project. And using istio for one product. And have changed to prefix but still not loading. The source code of this test app is available in the link I posted in the last line. – uday Jul 19 '21 at 17:27
  • The link with the source code is not working, it's redirecting to "about:blank#blocked". – Mikołaj Głodziak Jul 20 '21 at 11:25

1 Answers1

0

I've reproduced your issue and everything works fine after changing http match from "exact" to "prefix" in the virtualservice, here is the proof: enter image description here

enter image description here

enter image description here