Kubernetes ingress unhealthy backend

0 votes

I've been using this load-balancer tutorial. It works fine when I use ngnix image but if I try and use my own app image it changes the backend to unhealthy.

My application redirects on / (returns a 302) but I added a livenessProbe in the pod definition:

    livenessProbe:
      httpGet:
        path: /ping
        port: 4001
        httpHeaders:
          - name: X-health-check
            value: kubernetes-healthcheck
          - name: X-Forwarded-Proto
            value: https
          - name: Host
            value: foo.bar.com

My ingress:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: foo
spec:
  backend:
    serviceName: foo
    servicePort: 80
  rules:
  - host: foo.bar.com

Service configuration:

kind: Service
apiVersion: v1
metadata:
  name: foo
spec:
  type: NodePort
  selector:
    app: foo
  ports:
    - port: 80 
      targetPort: 4001

When I do a ingress describe I get:

backends:       {"k8s-be-32180--5117658971cfc555":"UNHEALTHY"}

The ingress rules:

Rules:
  Host  Path    Backends
  ----  ----    --------
  * *   foo:80 (10.0.0.7:4001,10.0.1.6:4001)
Jan 16, 2019 in Kubernetes by DragonLord999
• 8,450 points
7,123 views

1 answer to this question.

0 votes

Add a readinessProbe(copy your livenessProbe). It's explained in the GCE L7 Ingress Docs.

Health checks

Currently, all service backends must satisfy either of the following requirements to pass the HTTP health checks sent to it from the GCE loadbalancer: 1. Respond with a 200 on '/'. The content does not matter. 2. Expose an arbitrary url as a readiness probe on the pods backing the Service.

Just make sure that your readinessProbe is pointing to the same port that you exposed for ingress. It seems fine in your case because you've got just one port but just in case you want to add another you may get errors.

Also don't use the custom headers in you readinessProbe. They seem to cause trouble sometimes

answered Jan 16, 2019 by DareDev
• 6,890 points

Related Questions In Kubernetes

0 votes
1 answer

Kubernetes Ingress not resolving backend service

I think you're trying to access the ingress ...READ MORE

answered Oct 1, 2018 in Kubernetes by Kalgi
• 52,360 points
2,242 views
0 votes
1 answer

Forcing ssl for Kubernetes Ingress on GKE

https://github.com/kubernetes/ingress-gce#frontend-https If you want to block http, you ...READ MORE

answered Sep 6, 2018 in Kubernetes by ajs3033
• 7,300 points
4,187 views
0 votes
2 answers

Deny access to some specific paths while using kubernetes ingress

Try to create two Ingresses first by default ...READ MORE

answered Sep 21, 2018 in Kubernetes by Nilesh
• 7,060 points
11,975 views
+1 vote
1 answer
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,360 points
1,352 views
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,316 views
0 votes
1 answer

Kubernetes HTTPS Ingress in Google Container Engine

n order to have HTTPs service exposed ...READ MORE

answered Nov 23, 2018 in Kubernetes by DareDev
• 6,890 points
838 views
0 votes
1 answer

What's the difference between kubernetes load balancer and ingress controller?

Load Balancer: So Kubernetes LoadBalancer just points ...READ MORE

answered Jan 4, 2019 in Kubernetes by DareDev
• 6,890 points
13,822 views
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