Reputation: 59
Hi I am deploying a flutter based web application into AKS private cluster. I configured NGINX ingress controller in my cluster and added dns entries for my ingress controller external IP. I configured a route for my service, when i am hitting only DNS name it's loading the application correctly but when i try to refresh it's giving 404 error.
When i browse "https://app.myorg.com" it's redirecting to "**https://app.myorg.com/dashboard**"
but when i try to hit "**https://app.myorg.com/dashboard**" manually it's giving 404 error. Please help me to resolve this issue.
---------------Here is my pod file---------
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend
namespace: web-ns
labels:
app: frontend
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend
image: frontend:1.5
imagePullPolicy: Always
-------------Here is the Service file----------
apiVersion: v1
kind: Service
metadata:
name: frontend-srv
spec:
type: ClusterIP
ports:
- name: http
port: 80
- name: https
port: 443
selector:
app: frontend
-------------Here is the ingress route file----------
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: frontend-ingress
namespace: web-ns
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: app.myorg.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: frontend-srv
port:
number: 80
Upvotes: 0
Views: 191
Reputation: 334
You received a 404
because the ingress controller does not have a route configured for the "/dashboard
" path.
From your ingress rules, It'll match only root (/
) path. (https://app.myorg.com/
)
You can try with the following configuration: (It will be better if you can set specific paths for your ingress controller rules.)
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: frontend-ingress
namespace: web-ns
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: app.myorg.com
http:
paths:
- path: /*
pathType: Prefix
backend:
service:
name: frontend-srv
port:
number: 80
Upvotes: 1