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
The source code of application is in app folder of repo