I am trying to deploy my microservice application on Kubernetes using minikube. I have an angular front service and two backend services and I used this configuration to lunch deployment and services
apiVersion: apps/v1
kind: Deployment
metadata:
name: searchservice
labels:
app: searchservice
spec:
selector:
matchLabels:
app: searchservice
template:
metadata:
labels:
app: searchservice
spec:
containers:
- name: searchservice
image: ayoubdali/searchservice:0.1.9-SNAPSHOT
ports:
- containerPort: 8070
---
apiVersion: v1
kind: Service
metadata:
name: searchservice
spec:
type: NodePort
selector:
app: searchservice
ports:
- protocol: TCP
# Port accessible inside cluster
port: 8070
# Port to forward to inside the pod
targetPort: 8070
nodePort: 31000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: searchappfront
labels:
app: searchappfront
spec:
selector:
matchLabels:
app: searchappfront
template:
metadata:
labels:
app: searchappfront
spec:
containers:
- name: searchappfront
image: ayoubdali/searchappfront:0.6.5
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: searchappfront
spec:
type: NodePort
selector:
app: searchappfront
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: subscriberservice
labels:
app: subscriberservice
spec:
selector:
matchLabels:
app: subscriberservice
template:
metadata:
labels:
app: subscriberservice
spec:
containers:
- name: subscriberservice
image: ayoubdali/subscriber-service:0.1.0-SNAPSHOT
ports:
- containerPort: 8090
---
apiVersion: v1
kind: Service
metadata:
name: subscriberservice
spec:
type: NodePort
selector:
app: subscriberservice
ports:
- protocol: TCP
port: 8090
#targetPort: 80
nodePort: 31102
and this configuration for the ingress service
apiVersion: networking.k8s.io/v1beta1 # for versions before 1.14 use extensions/v1beta1
kind: Ingress
metadata:
name: ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
rules:
- host: app.info
http:
paths:
- path: /
backend:
serviceName: searchappfront
servicePort: 80
- path: /api
backend:
serviceName: subscriberservice
servicePort: 8090
But when I open app.info/ I got a blank page with javascript error like
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
I tried deploying the application using docker compose and it works fine.