liveBook · Manning

Readiness check

As explained in Spring in Action, Sixth Edition

A readiness probe is a Kubernetes health check that determines whether an application instance is prepared to receive traffic.

A readiness check tells Kubernetes whether an application instance can receive traffic. During startup, an application may still be alive while initialization is incomplete, so Kubernetes keeps it running but routes no requests to it until readiness becomes available. section 18.3.2 section 18.3.3

Readiness differs from related health signals:

  • Readiness indicates whether the application is prepared to handle traffic. section 18.3.3
  • Liveness indicates whether the application should continue running; Kubernetes can restart a pod when liveness is down. section 18.3.3
  • The Actuator health endpoint can expose liveness and readiness as health groups, which are distinct from dependency health alone. section 18.3.3

Enable and route readiness checks

Enable the probes in application.yml with management.health.probes.enabled: true. Kubernetes can then query /actuator/health/readiness on the application container. A readiness result of UP permits traffic; a result of DOWN keeps traffic away while the application remains running. section 18.3.3

apiVersion: apps/v1
kind: Deployment
metadata:
  name: taco-cloud-deploy
  labels:
    app: taco-cloud
spec:
  replicas: 3
  selector:
    matchLabels:
      app: taco-cloud
  template:
    metadata:
      labels:
        app: taco-cloud
    spec:
      containers:
      - name: taco-cloud-container
        image: tacocloud/tacocloud:latest
        livenessProbe:
          initialDelaySeconds: 2
          periodSeconds: 5
          httpGet:
            path: /actuator/health/liveness
            port: 8080
        readinessProbe:
          initialDelaySeconds: 2
          periodSeconds: 5
          httpGet:
            path: /actuator/health/readiness
            port: 8080

Use the Deployment listing to inspect the readinessProbe settings, polling interval, startup delay, endpoint path, and container port. section 18.3.3

How Spring in Action, Sixth Edition covers it

How deep it goes
Explains startup behavior, distinguishes readiness from liveness, and shows Spring Boot and Kubernetes configuration.
Examples
Shows application.yml probe enablement, Actuator readiness responses, and a Kubernetes Deployment readinessProbe.
What you can do after
Apply it via Spring Boot Actuator and Kubernetes HTTP probes to control when instances receive traffic.
How it connects
Connects readiness checks with Kubernetes, Spring Boot Actuator, health endpoints, liveness probes, and graceful shutdown.

Also explained in

Compare how 7 books explain readiness check →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring in Action, Sixth Edition. The section links point to the parts of the book it draws on.