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.
But, with istio gateway, it is just showing an empty page.
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
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
In kiali pod logs, it is showing like this.
[2021-07-17T18:25:04.882Z] "GET / HTTP/1.1" 200 - via_upstream - "-" 0 858 11 11 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "f0042d7b-63e6-9e81-9b89-4ed2f5ad15dc" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:37925 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:25:13.400Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 3 2 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "630d94ca-57f2-9bf1-abfa-b5e61bdd2670" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:50927 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:25:25.282Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "35494813-ac68-9f3a-8929-eece8c067941" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:57303 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:26:46.335Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "05d28016-207b-9d44-8e00-ebeac7dd9ad1" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:41367 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:27:27.385Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "36924871-4f19-9529-a400-525add32c843" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:33531 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:28:05.690Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "48ecf76f-fc93-988e-bbcc-ab1bc90fdb23" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:34253 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:28:08.529Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "4fb22460-d6e0-9e0f-88b6-7c75c773b987" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:34253 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:30:31.172Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "bc272b42-415f-926f-b2bd-a40eae9a87b9" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:39531 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default
[2021-07-17T18:30:56.076Z] "GET / HTTP/1.1" 304 - via_upstream - "-" 0 0 1 1 "10.244.1.1" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.164 Safari/537.36" "464d4718-1c13-9b93-b1e5-ea194576079e" "20.85.0.248" "10.244.1.47:3000" inbound|3000|| 127.0.0.6:53951 10.244.1.47:3000 10.244.1.1:0 outbound_.8080_._.node-service.testing1.svc.cluster.local default