Skip to main content
  1. Posts/

Liveness and Readiness Check in Kubernetes

·213 words·1 min·
Note Kubernetes GCP
Table of Contents

Readiness and Liveness probe
#

The readiness probe checks if the service in pod can accept traffic. Kubernetes will remove the pod if the readiness probe fails.

The liveness probe is used to check whether the pod is still alive and functioning. If the liveness check fails, the pod will be restarted by Kubernetes.

Types of readiness and liveness probe
#

We can use HTTP, command or TCP probe.

Get configuration for liveness and readiness
#

We can run the following command to get the pod configuration:

kubectl -n <your-namespace> get pod <your-pod-name> -o yaml

You will get the configuration for this pod in YAML format. The liveness setting is under section livenessProbe, and the readiness setting is under section readinessProbe.

You can also go to the GCP console (https://console.cloud.google.com/), select your projects. Then go to Kubernetes Engine --> Workloads, click your service name and go to the pod overview page. Then you can click the YAML tab page to see the configuration for this pod.

For the liveness probe, you will see something like this:

livenessProbe:
    failureThreshold: 3
    httpGet:
        path: /health_check
        port: 8080
        scheme: HTTP
    initialDelaySeconds: 15
    periodSeconds: 5
    successThreshold: 1
    timeoutSeconds: 1

References
#

Related

Notes on Using GCP Logging
·345 words·2 mins
Note GCP Logging Regex
How to Download Files from Google Cloud Storage in the Databricks Workspace Notebook
··551 words·3 mins
Note Databricks GCP Ubuntu
Retry for Google Cloud Client
·197 words·1 min
Python GCP