Troubleshooting Unhealthy Kubernetes Ingress with a Custom Application

After following a load balancer tutorial, my custom app’s ingress remains unhealthy (HTTP 302 redirects) despite configured liveness/readiness probes at /health. Revised configuration:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: newapp-deploy
spec:
  template:
    spec:
      containers:
      - name: newapp
        livenessProbe:
          httpGet:
            path: /healthz
            port: 8081
apiVersion: v1
kind: Service
metadata:
  name: newapp-service
spec:
  selector:
    app: newapp
  ports:
  - port: 8081
    targetPort: 8081

The 302 redirect may be caused by the health check endpoint not returning a direct 200 response because it is configured to redirect. In my experience, verifying that the /healthz endpoint is accessible without redirection is essential. It helps to test the endpoint directly with curl or a similar tool from within the cluster to confirm its behavior. Additionally, ensure that the container isn’t performing authentication or other logic on the health check URL that might cause the unexpected redirect.

i suspect your ingress is rewriting /healthz triggerring 302. i had to isolate health checks on a separate port to bypass ssl offload. try a direct call to the endpoint and check if a middleware is causing the redirect.

hey, im wonderin if the ingress might be caching old routes. did u try a call to /healthz directly in the pod? also, any logs show extra redirect vibe? lets dig deeper together!