0

I use the Docker desktop and enable kubernetes on windows 10. but after running the program and applying yaml files, I only get 404.I did install Ingress but I dont know what is the problem!. below is my code:

Ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
 name: minimal-ingress
 annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
 ingressClassName: nginx
 rules:
 - host: ticketing.dev
   http:
     paths:
      - path: /api/users/?(.*)
        pathType: Prefix
        backend:
          service:
           name: auth-srv
           port:
             number: 3000

my service:

apiVersion: apps/v1
kind: Deployment
metadata:
 name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
     app: auth
  template:
   metadata:
    labels:
     app: auth
   spec:
    containers:
     - name: auth
       image: me/auth
---
apiVersion: v1
kind: Service
metadata:
 name: auth-srv
spec: 
 selector:
  app: auth
 ports:
  - name: auth
    protocol: TCP
    port: 3000
    targetPort: 3000
Nega
  • 119
  • 8

2 Answers2

0

Edit your deployment and add container port reference just like below and reapply:

apiVersion: apps/v1
kind: Deployment
metadata:
 name: auth-depl
spec:
  replicas: 1
  selector:
    matchLabels:
     app: auth
  template:
   metadata:
    labels:
     app: auth
   spec:
    containers:
     - name: auth
       image: me/auth
       ports:
         - containerPort: 3000
           name: auth
0

You can find the answer in here but shortly it is because nginx is listening on port 80 by default and on windows probably some programs are running on port 80.

Nega
  • 119
  • 8