Service Liveliness Probe Divert Log in Kubernetes

Luca Berton
6 min readOct 30, 2024

If you want to divert the logs of a liveness probe in a Kubernetes service, you typically want to capture the output of the probe execution. For example, if your liveness probe is an HTTP or exec command, you might want to capture logs from that probe to troubleshoot failures or analyze the behavior of the application over time.

Here are some ways to manage and capture liveness probe logs:

1. Using Kubernetes Events for Probe Failures:

Kubernetes generates events when liveness probes fail. You can check the events for a pod using kubectl to see why the liveness probe is failing. These events can help you understand what went wrong with the probe without modifying the application itself.

kubectl describe pod <pod-name>

In the output, look for events related to Liveness probe failed. This gives you a high-level view of probe failures, but it won’t capture detailed logs of the probe itself.

2. Logging in the Application:

If you are using an exec probe to run a command inside the container, ensure that your application is logging the relevant information for the probe execution. You can then review the container logs using kubectl logs.

--

--

Luca Berton

I help creative Automation DevOps, Cloud Engineer, System Administrator, and IT Professional to succeed with Ansible Technology to automate more things everyday