Example 4-2. Container with readiness probe apiVersion : v1 kind : Pod metadata : name : pod-with-readiness-check spec : containers : -  image : k8spatterns/random-generator:1.0 name : random-generator readinessProbe : exec : command : [ "stat", "/var/run/random-generator-ready" ] Check for the existence of a file the application creates to indicate it’s ready to serve requests.  stat  returns an error if the file does not exist, letting the readiness check fail. Again, it is up to your implementation of the health check to decide when your appli‐ cation is ready to do its job and when it should be left alone. While process health checks and liveness checks are intended to recover from the failure by restarting the container, the readiness check buys time for your application and expects it to recover by itself. Keep in mind that Kubernetes tries to prevent your container from receiving new requests (when it is shutting down, for example), regardless of whether the read‐ iness check still passes after having received a SIGTERM signal. In many cases, you have liveness and readiness probes performing the same checks. However, the presence of a readiness probe gives your container time to start up. Only by passing the readiness check is a Deployment considered to be successful, so that, for example, Pods with an older version can be terminated as part of a rolling update. The liveness and readiness probes are fundamental building blocks in the automation of cloud-native applications. Application frameworks such as Spring actuator, Wild‐ Fly Swarm health check, Karaf health checks, or the MicroProfile spec for Java pro‐ vide implementations for offering  Health Probes . To be fully automatable, cloud-native applications must be highly observable by pro‐ viding a means for the managing platform to read and interpret the application health, and if necessary, take corrective actions. Health checks play a fundamental role in the automation of activities such as deployment, self-healing, scaling, and oth‐ ers. However, there are also other means through which your application can provide more visibility about its health. Discussion 38  |  Chapter 4: Health Probe