Kubernetes - ingress-nginx "no active endpoint" error

2k Views Asked by At

I am building a microservice application. I am unable to send request to one of the services using postman:

Endpoint I am sending POST request to using postman:

http://cultor.dev/api/project

Error : "project-srv" does not have any active Endpoint (ingress-nginx returns 503 error)

Note

All the other microservices are running fine which use exact same config.

ingress-nginx config:

apiVersion: extensions/v1beta1
kind: Ingress
metadata: 
    name: ingress-service 
    annotations: 
        nginx.ingress.kubernetes.io/default-backend: ingress-nginx-controller
        nginx.ingress.kubernetes.io/use-regex: 'true'
spec: 
    rules: 
        - host: cultor.dev 
          http: 
            paths:
              - path: /api/project/?(.*)
                backend: 
                  serviceName: project-srv 
                  servicePort: 3000
              - path: /api/profile/?(.*)
                backend: 
                  serviceName: profile-srv 
                  servicePort: 3000
              - path: /api/users/?(.*) 
                backend: 
                  serviceName: auth-srv 
                  servicePort: 3000
              - path: /?(.*) 
                backend: 
                  serviceName: client-srv 
                  servicePort: 3000

ClusterIP services:

$ kubectl get svc
NAME                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)             AGE
auth-srv            ClusterIP   10.245.52.208    <none>        3000/TCP            40m
client-srv          ClusterIP   10.245.199.94    <none>        3000/TCP            39m
kubernetes          ClusterIP   10.245.0.1       <none>        443/TCP             24d
nats-srv            ClusterIP   10.245.1.58      <none>        4222/TCP,8222/TCP   39m
profile-srv         ClusterIP   10.245.208.174   <none>        3000/TCP            39m
project-srv         ClusterIP   10.245.131.56    <none>        3000/TCP            39m

LOGS

inress-nginx:

45.248.29.8 - - [02/Oct/2020:15:16:52 +0000] "POST /api/project/507f1f77bcf86cd799439011 HTTP/1.1" 503 197 "-" "PostmanRuntime/7.26.5" 591 0.000 [default-project-srv-3000] [] - - - - e1ae0615f49091786d56cab2bb9c94c6
W1002 15:17:59.712320       8 controller.go:916] Service "default/project-srv" does not have any active Endpoint.
I1002 15:17:59.814364       8 main.go:115] successfully validated configuration, accepting ingress ingress-service in namespace default
W1002 15:17:59.827616       8 controller.go:916] Service "default/project-srv" does not have any active Endpoint.
1

There are 1 best solutions below

0
On

It was error with the labels as suggested by @Kamol Hasan.

The pod selector label in the 'Deployment' config was not matching selector in it's 'Service' config.