Arsen
Arsen

Reputation: 569

Ingress-nginx returning 503 to app-root path

I have deployed ingress nginx controller using this Ingress-Nginx-Doc to Aws EKS Cluster

Issue:

---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  namespace: mynamespace
  annotations:
    kubernetes.io/ingress.class: "nginx"
    nginx.ingress.kubernetes.io/use-regex: "true"
    nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
spec:
  - path: /
      backend:
        serviceName: my-app
        servicePort: 7300

when I access my app. http://load-balancer-url/ nginx throwing 503.

[27/May/2020:15:27:40 +0000] "GET / HTTP/1.1" 503 600 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36" 662 0.000 [namespace-serviceName-7300] [] - - - - 21eb2db883548292ce20a71ddf45df99
W0527 15:39:07.037844       6 controller.go:909] Service "mynamespace/service" does not have any active Endpoint.

Am I missing any annotations?

---
apiVersion: v1
kind: Service
metadata:
  name: my-app
  labels:
    app: my-app
spec:
  type: ClusterIP
  ports:
    - protocol : TCP
      port: 7300
      targetPort: 7300
  selector:
    name: my-app
    namespace: my-namespace

Upvotes: 0

Views: 687

Answers (1)

Arghya Sadhu
Arghya Sadhu

Reputation: 44549

The issue here is the service my-app has none in the Endpoints section which should have IPs of the pods.

Referring from docs you should check that the spec.selector field of your service actually selects for metadata.labels values on your Pods. A common mistake is to have a typo or other error, such as the service selecting for name=my-app, but the Deployment specifying something else.

Upvotes: 2

Related Questions