i'm trying to deploy my app: front: angular and back:nestjs using docker and kubernetes ingress on my local windows machine. so locally my app is working, i push the app on docker hub locally and still working, i deploy it on kubernetes :
apiVersion: apps/v1
kind: Deployment
metadata:
name: smartagri-back
spec:
replicas: 1
selector:
matchLabels:
app: smartagri-back
template:
metadata:
labels:
app: smartagri-back
spec:
containers:
- name: smartagri-back
image: maryem1994/smartagri:back-3
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: smartagri-back
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: smartagri-back
and for frontend:
apiVersion: apps/v1
kind: Deployment
metadata:
name: smartagri-front
spec:
replicas: 1
selector:
matchLabels:
app: smartagri-front
template:
metadata:
labels:
app: smartagri-front
spec:
containers:
- name: smartagri-front
image: maryem1994/smartagri:front-3
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: smartagri-front
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: smartagri-front
and finally my nginx yaml file:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-service
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
ingressClassName: nginx
rules:
- host: smartagri-app.com
http:
paths:
- path: /saback
pathType: Prefix
backend:
service:
name: smartagri-back
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: smartagri-front
port:
number: 80
but always it shows me 500 error. PS: the ingress controller shows me nothing ! no errors.
So the solution is that i run this command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml
and everything worked