Error saying Ingress Error No healthy backends could be found Check pod liveness probes for more details

0 votes

I have a ingress like the below one.

kubectl get ing test-ingress -o yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"extensions/v1beta1","kind":"Ingress","metadata":{"annotations":{"kubernetes.io/ingress.class":"tectonic"},"name":"test-ingress","namespace":"nstest"},"spec":{"rules":[{"host":"test.nstest.k8s.privatecloud.com","http":{"paths":[{"backend":{"serviceName":"test","servicePort":8080},"path":"/"}]}}]}}
    kubernetes.io/ingress.class: tectonic
  creationTimestamp: 2018-03-27T17:57:02Z
  generation: 1
  name: test-ingress
  namespace: "nstest"
  resourceVersion: "19985087"
  selfLink: /apis/extensions/v1beta1/namespaces/nstest/ingresses/test-ingress
  uid: 4100bd04-31e8-11e8-8f7b-5cb9018ebebc
spec:
  rules:
  - host: test.nstest.k8s.privatecloud.com
    http:
      paths:
      - backend:
          serviceName: test
          servicePort: 8080
        path: /
status:
  loadBalancer: {}

My service is as follows,

kubectl get svc test -o yaml

apiVersion: v1
kind: Service
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":"app":"test"},"name":"test","namespace":"nstest"},"spec":{"ports":{"port":8080,"protocol":"TCP","targetPort":8080}],"selector":{"app":"test"}}}
  creationTimestamp: 2018-03-27T17:57:02Z
  labels:
    app: test
  name: test
  namespace: "nstest"
  resourceVersion: "19985067"
  selfLink: /api/v1/namespaces/nstest/services/test
  uid: 40f975f3-31e8-11e8-8f7b-5cb9018ebebc
spec:
  clusterIP: 172.158.50.20
  ports:
  - port: 8080
    protocol: TCP
    targetPort: 8080
  selector:
    app: test
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

The pods are running fine. What is wrong with this? Why the routing from ingress to service not working.

Error on accessing ingress endpoint,

Ingress Error
No healthy backends could be found.
Check pod liveness probes for more details.
Sep 12, 2018 in Kubernetes by lina
• 8,220 points
1,569 views

2 answers to this question.

0 votes

You should give the port in your Service spec a "name", and refer to that in your Ingress:

---
apiVersion: v1
kind: Service
metadata:
  name: myApp
spec:
  selector:
    app: myApp
  ports:
  - name: http
    port: 80
    targetPort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myApp
spec:
  rules:
  - host: myapp.domain.com
    http:
      paths:
      - path: /
        backend:
          serviceName: myApp
          servicePort: http
answered Sep 12, 2018 by Kalgi
• 52,350 points
0 votes

In the Dockerfile, you need to export a port (to which the server is listening, say 8080) like this:

EXPOSE 8080/tcp

In your deployment, you need to specify the containerPort as 8080.

answered Sep 12, 2018 by Hannah
• 18,520 points

Related Questions In Kubernetes

0 votes
1 answer
0 votes
2 answers

Error saying “Error from server (NotFound): the server could not find the requested resource”

official Documentation says: A client should be skewed ...READ MORE

answered Sep 19, 2018 in Kubernetes by Nilesh
• 7,060 points
4,427 views
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17, 2019 in Others by anonymous
15,574 views
0 votes
1 answer

permissions related to AWS ECR

if you add allowContainerRegistry: true, kops will add those permissions ...READ MORE

answered Oct 9, 2018 in Kubernetes by Kalgi
• 52,350 points
1,430 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP