<p>I have a simple SpringBoot application (really a REST-based microservice) that I am deploying in Kubernetes.</p>

<p>It has one downstream dependency (another REST-based web service).
I know that for the REST endpoint feeding the <strong><em>liveness</em></strong> probe I should not return a failure if my downstream dependency is unavailable / inaccessible (as Kubernetes restarting my microservice pod won't fix the dependency!).</p>

<p>But in the REST endpoint feeding my <strong><em>readiness</em></strong> probe should I be checking downstream dependencies? I'd rather just do something basic but if I need to be checking more then I will.</p>

<pre><code>@RequestMapping("/health")
public String getHealth() {
    return "OK";
}
</code></pre>

kellyfj
<p>Assuming, the liveness of your spring-boot app (user's perspective) does not require the dependent service to be up, your idea of checking the status of the Readiness Probe is a right thing to do. </p>

<p>As the dependent app is a REST service, you could expose an HTTP/HTTPS endpoint to be checked by the <em>readiness probe</em>. And keep spring-boot app's health check (or similar) endpoint for <em>liveness probe</em>.</p>

<p>However, beware that your pod which runs first microservice (spring-boot app) could become unresponsive if the dependent service didn't respond.</p>

<p>Therefore, providing correct timeouts (initialDelays &amp; periodDelay) with success and failure thresholds help you mitigate such unresponsive status. For example;</p>

<pre><code>readinessProbe:
  httpGet: # make an HTTP request to dependent's health/readiness endpoint
    port: &lt;port&gt;
    path: /health
    scheme: HTTP 
  initialDelaySeconds: 10 # how long to wait before checking
  periodSeconds: 10 # how long to wait between checks
  successThreshold: 1 # how many successes to hit before accepting
  failureThreshold: 3 # how many failures to accept before failing
  timeoutSeconds: 15
</code></pre>

<p>The official doc: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#define-readiness-probes</a></p>

<p>A good article: <a href="https://itnext.io/kubernetes-readiness-probe-83f8a06d33d3" rel="nofollow noreferrer">https://itnext.io/kubernetes-readiness-probe-83f8a06d33d3</a></p>
