How to get health checks to work on Kubernetes load balancer

Posted May 2, 2019 7.3k views
Load BalancingKubernetes

Please tell me how to get health checks to work on a load balancer which is used by Kubernetes. I am running DOs managed Kubernetes service and spawned a Load Balancer service which has created an external load balancer, however when I hit the IP via HTTP I get a 503 gateway.
When I check the health statuses of the nodes, they appear down.

Any help would be much appreciated. This is my yml for the service:

apiVersion: v1
kind: Service
  name: wordpress
    app: wordpress
  annotations: "http" "/health"
  type: LoadBalancer
  externalTrafficPolicy: Local
  # the port the service serves on
    - port: 80
    app: wordpress
    tier: frontend

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

Problem solved: After executing kubectl exec -it pod-name-1234 sh, I used top to see Apache wasn’t running in my applications container. After checking the image, I noticed Apache was never going to run as it wasn’t included in the container build.
Included Apache, problem solved after applying the new deployment yaml file.