Ingress backend showing as unhealthy in Kubernetes cluster

I’m having trouble with my Kubernetes setup. My ingress backend is showing as unhealthy, but I can’t figure out why. Here’s what I’ve done:

  1. Set up a NodePort service for my app
  2. Created an ingress resource
  3. Added a livenessProbe to my pod

The app works fine with the Nginx image, but not with my custom image. The custom app redirects on the root path. Here’s a simplified version of my setup:

# Deployment
livenessProbe:
  httpGet:
    path: /health
    port: 3000

# Ingress
spec:
  rules:
  - host: myapp.example.com
    http:
      paths:
      - path: /
        backend:
          serviceName: myapp
          servicePort: 80

# Service
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: 3000

When I check the ingress status, it shows:

backends: {"k8s-be-12345--abcdef":"UNHEALTHY"}

I’ve tried adding a readinessProbe too, but no luck. Any ideas on what might be causing this?

Have you checked your custom app’s logs? They might reveal why the ingress backend is unhealthy. Also, ensure your app is actually listening on port 3000 as specified in your service config. Another thing to consider is your /health endpoint implementation. Make sure it’s returning a 200 OK status and not redirecting. If you’re using a custom image, verify it’s compatible with your ingress controller’s requirements. Lastly, try accessing your app directly through the NodePort to isolate if the issue is with the app itself or the ingress setup. These steps should help pinpoint the problem.

hey there! have u tried checkin ur custom app’s logs? they might give u some clues bout why the backend’s actin up. also, make sure ur /health endpoint isn’t redirectin or doin anythin funky. oh, and double-check if ur app’s actually listenin on port 3000 like u set up. wht happens if u try accessin ur app directly thru the NodePort? tht could help narrow down the issue. lemme know if u need more help!

hey mate, maybe check ur app’s /health endpoint. sometimes it can be a pain if it redirects or doesn’t return 200 OK. also, double-check ur app’s listening on port 3000 like u set in the service. those r usually the culprits for me. good luck!