<p>I want to implement custom logic to determine readiness for my pod, and I went over this: <a href="https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.kubernetes-probes.external-state" rel="noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.kubernetes-probes.external-state</a> and they mention an example property:
<code>management.endpoint.health.group.readiness.include=readinessState,customCheck</code></p>
<p>Question is - how do I override <code>customCheck</code>?
In my case I want to use HTTP probes, so the yaml looks like:</p>
<pre><code>readinessProbe:
  initialDelaySeconds: 10
  periodSeconds: 10
  httpGet:
    path: /actuator/health
    port: 12345
</code></pre>
<p>So then again - where and how should I apply logic that would determine when the app is ready (just like the link above, i'd like to rely on an external service in order for it to be ready)</p>

<p>customCheck is a key for your custom HealthIndicator. The key for a given HealthIndicator is the name of the bean without the HealthIndicator suffix</p>
<p>You can read:
<a href="https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.health.writing-custom-health-indicators" rel="nofollow noreferrer">https://docs.spring.io/spring-boot/docs/current/reference/html/actuator.html#actuator.endpoints.health.writing-custom-health-indicators</a></p>
<p>You are defining readinessProbe, so probably hiting /actuator/health/readiness is a better choice.</p>
<pre><code>public class CustomCheckHealthIndicator extends AvailabilityStateHealthIndicator {

    private final YourService yourService;

    public CustomCheckHealthIndicator(ApplicationAvailability availability, YourService yourService) {
        super(availability, ReadinessState.class, (statusMappings) -&gt; {
            statusMappings.add(ReadinessState.ACCEPTING_TRAFFIC, Status.UP);
            statusMappings.add(ReadinessState.REFUSING_TRAFFIC, Status.OUT_OF_SERVICE);
        });
        this.yourService = yourService;
    }

    @Override
    protected AvailabilityState getState(ApplicationAvailability applicationAvailability) {
        if (yourService.isInitCompleted()) {
            return ReadinessState.ACCEPTING_TRAFFIC;
        } else {
            return ReadinessState.REFUSING_TRAFFIC;
        }
    }

}
</code></pre>
