-1

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.

1
  • Where is the port 3000 counterpart in the smartagri-back service? Commented Dec 6, 2024 at 3:36

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.