0

We are using OpenShift Online Pro.

I have an app where I want to add a readiness health check. If I check the URL from my laptop it is good:

simon$ curl --head  http://x.y.pro-eu-west-1.openshiftapps.com/api/ready
HTTP/1.1 200 OK

If I use the console to add the checks it suggests "HTTP GET", "/api/ready" on the listening port "8080". The docs at https://docs.openshift.com/online/dev_guide/application_health.html suggest 15s delay and 1s timeout might be reasonable so I give that a go.

Exporting the dc/backend shows:

readinessProbe:
      failureThreshold: 3
      httpGet:
        path: /api/ready
        port: 8080
        scheme: HTTP
      initialDelaySeconds: 15
      periodSeconds: 10
      successThreshold: 1
      timeoutSeconds: 1

This gives events with errors such as:

Readiness probe failed: Get http://10.130.7.168:8080/api/ready: dial tcp 10.130.7.168:8080: getsockopt: connection refused

The app is PHP so fast to start but after 5 minutes and 28 of those warnings I give up and delete the health check.

If I then wait to see "Created container" for the next deployment I can go and curl the "/api/ready" inside of one minute and get a healthy response.

What am I missing to get the check to work?

simbo1905
  • 6,321
  • 5
  • 58
  • 86
  • And you are using the supplied PHP S2I builder, or your own PHP image? – Graham Dumpleton Mar 07 '18 at 07:50
  • good point. deployed in the standard php s2i and sample app and it worked fine and the pod logs showed the polling "Go-http-client/1.1" requests. I could open a terminal and curl it and see "curl/7.29.0" in the logs. If I open a terminal to my image built with a custom s2i it cannot do a curl to `http://localhost:8080/index.php`. So it seems that the server isn't accepting traffic accept from the public route. – simbo1905 Mar 07 '18 at 20:40
  • The php s2i sample doesn't come with readiness probe checks. Did you add one? Have you tried to increase the timeoutSeconds value to other than 1? – Michael Johann Mar 07 '18 at 21:01
  • Even though you've explicitly said your pod's container is listening on port `8080`, the application can run on any port, and be forwarded to any port through the service. It would appear that your service is sending traffic over port `8000`. I would suggest trying to curl `http://localhost:8000/api/ready` from within the pod, and see if that works. – Will Gordon Mar 07 '18 at 21:04
  • @MichaelJohann yes I added one which is why i could see it in the terminal polling the app using "Go-http-client/1.1" – simbo1905 Mar 07 '18 at 21:23
  • 1
    @WillGordon wow. if i go in on the terminal tab of the pod on the web console and `curl http://localhost:8000/api/ready` it gives a "$?" of 0. if I `curl http://localhost:8080/api/ready` I get connection denied. Yet I haven't seen anything in the config that names 8000. nor anything in my question. – simbo1905 Mar 07 '18 at 21:28
  • aha! https://github.com/UniqKey/s2i-nginx-php7-container/blob/master/7.2/Dockerfile#L8 – simbo1905 Mar 07 '18 at 21:31
  • the web console was pre-populating the port as 8080 by default which I had taken on faith was the correct port. – simbo1905 Mar 07 '18 at 21:35
  • 1
    Sorry, I only knew to look at port 8000 because I work for OpenShift, and based on your `dc/backend` I was able to find your project. Then using `oc get all` I saw your service was configured to serve port 8000. – Will Gordon Mar 07 '18 at 22:16
  • that is fine by me. thanks :-) – simbo1905 Mar 08 '18 at 21:18

1 Answers1

0

My bad. I set up the checks via the Web Console and it suggests port 8080 by default. Yet the s2i I am using is listening on 8000.

simbo1905
  • 6,321
  • 5
  • 58
  • 86