0

I have deployed my service running on spring boot in openshift. The spring boot service initializes good and we see the below logs which is good.

2020-05-06 19:32:33.930  INFO 1 --- [           main] c.a.r.l.MyApplication   : Started MyApplication in 44.227 seconds (JVM running for 67.578)
2020-05-06 19:32:38.706  INFO 1 --- [nio-8198-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-05-06 19:32:38.709  INFO 1 --- [nio-8198-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-05-06 19:32:38.802  INFO 1 --- [nio-8198-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 93 ms

However the containers ready status shows 0/1 and after 5 mins i see this warning and the pod restarts.

The container has been running for more than five minutes and has not passed its readiness check

and i see

Readiness probe failed: HTTP probe failed with statuscode: 404

What could be wrong?

lr-pal
  • 339
  • 2
  • 6
  • 20

1 Answers1

0
Readiness probe failed: HTTP probe failed with statuscode: 404

This indicates that the URL that you specified for your readinessProbe does not exist (HTTP 404). So check how your readinessProbe is defined (which URI is called) and make sure there is a valid response.

For Spring Boot, there is an actuator available for Health endpoints, see the following documentation: https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html

Here is an example:

[..]
spec:
  containers:
  - args:
    image: k8s.gcr.io/readiness 
    readinessProbe: 
    httpGet:
      path: /healthz

In the example above, make sure that the /healthz endpoint exists.

You can find more information on how to configure Readiness Probes in the OpenShift documentation.

Simon
  • 4,251
  • 2
  • 24
  • 34
  • i am running into a http 401 error now: any suggestions? Readiness probe failed: HTTP probe failed with statuscode: 401 – lr-pal May 18 '20 at 14:25
  • `HTTP 401` means `Unauthorized`. The endpoint you specify in a `readinessProbe` should be reachable without having to enter a username / password or similar. – Simon May 18 '20 at 16:50
  • is there anything in my spring boot service i need to configure that makes it non authorizing – lr-pal May 18 '20 at 18:15
  • I am guessing your application uses authorization by default. Can you add what you implemented already and how you implemented the health check endpoint in your original question? This would help us suggesting a solution. – Simon May 18 '20 at 18:53
  • let me dig on what it does on the authorization part by default and get back. thanks for your advice – lr-pal May 18 '20 at 18:57