Kubernetes readinessProbe: testing container's availability

1 min read | by Jordi Prats

Some applications might temporally not being able to server traffic due to some work it is doing: For example, loading data, contacting with external services... If we want to have a way to temporally disable traffic without restarting the application we will need to configure a readinessProbe

Configure a readinessProbe is quite similar to configure a livenessProbe or a startupProbe:

apiVersion: v1
kind: Pod
metadata:
  name: demo-liveness
spec:
  containers:
  - name: liveness
    image: nginx
    livenessProbe:
      httpGet:
        path: /index.html
        port: 80
      initialDelaySeconds: 3
      periodSeconds: 3
    readinessProbe:
      httpGet:
        path: /index.html
        port: 80
      initialDelaySeconds: 3
      periodSeconds: 3

What we need to keep in mind is that with a readinessProbe we are assuming the application will recover by itself by temporally disabling traffic. If it does not recover we need to make sure the livenessProbe kicks in and restarts the application


Posted on 24/08/2021