Readiness Probe in Kubernetes – All you need to know!

Filed Under: Random
Kubernetes Readiness Probe

Hello, readers! In this article, we will be focusing on Readiness Probe in Kubernetes, in detail.

So, let us begin! 🙂

Also read: Kubernetes Liveliness Probe – All you need to know!

What is Readiness Probe in Kubernetes?

Before diving deep into the concept of Readiness Probe, let us understand the necessity and importance of probes in Kubernetes container lifecycle management.

As we all know, Kubernetes provides us with a Pod as the running instance of any application being hosted. Now, a simple question that arises is how can we perform a health check on the application?

That is, there needs to be some kind of mechanism that enables us to understand the readiness of the application in terms of traffic acceptance and the lifecycle of the application.

This is when Kubernetes introduced us to the concept of probes. Consider probes as the investigation for a health check and running arena of the instance.

We basically have three types of probes–

  • Liveliness probe: It enables us to catch the deadlock situation within an application and helps analyze when a container needs a restart.
  • Readiness probe: Gives a thumbs up regarding the ready state of the container for traffic acceptance.
  • Startup probe: It lets us know when the container has started and is up, running.

We will be focusing on the Readiness probe in detail.

A3 Pod is considered to be ready when all of its containers happen to belong to a ready state. The readiness probe lets us know the health of the pod in terms of containers. That is, it lets us know when the container is up and ready to start accepting traffic from the outside world in terms of services, etc.

A readiness probe is assigned to containers within the pod configurations.

Having understood about the Readiness probe, let us now focus on various probe values that will be using in a Readiness probe.

Configuring Probes

  1. initialDelaySeconds: The number of seconds to wait before the Readiness probe needs to be initiated. Default vlaue = 0 second. Minimum value = 0 second.
  2. periodSeconds: The time period during which the recurring probe check needs to be performed. Default value = 10 seconds. Minimum value = 1 second.
  3. timeoutSeconds: The time after which the readiness probe check times out.
  4. successThreshold: Minimum sequences for a probe to be considered as successful.
  5. failureThreshold: After the elapsed time, the pod will be marked unready. Default value = 3. Minimum value = 1 second.

Implementing Readiness Probe within a Kubernetes container

In this example, we have implemented a Readiness probe for a pod definition file at ease.

Example: Nginx pod deployment YAML

This YAML enables us to create a pod nginx-pod with Nginx as the base image for the container. Further, as soon as the container executes the below command:

/bin/sh -c "touch /tmp/live_probe; sleep 30; rm -rf /tmp/live_probe; sleep 100"

Further, the kubelet waits for 5 seconds before beginning the execution of the readiness probe. Here, the periodSeconds: 10 indicates that the readiness probe check will be performed every 10 seconds.

It executes the command cat /tmp/live_probe, and if the command fails, it marks the container as not ready and then the container does not receive traffic through the Kubernetes services at all.

apiVersion: v1
kind: Pod
    test: liveness-prob-exec
  name: nginx-pod
  - name: nginx-liveness-detect
    image: nginx
    - /bin/bash
    - -c
    - touch /tmp/live_probe; sleep 30; rm -rf /tmp/live_probe; sleep 100
        - cat
        - /tmp/live_probe
      initialDelaySeconds: 5
      periodSeconds: 10


By this, we have come to the end of this topic. Feel free to comment below, in case you come across any questions.

For more such posts related to Kubernetes, Stay tuned with us.

Till then, Happy Learning!! 🙂

Generic selectors
Exact matches only
Search in title
Search in content