DEV Community

INUH LEE
INUH LEE

Posted on

DevOps Interview Practice #1: What tool do you use to check if a pod is healthy?

I'm a Korean DevOps engineer preparing for international opportunities. Since English isn’t my first language, I’ve been practicing both my language skills and technical knowledge at the same time.

As part of my daily English practice, I asked ChatGPT (acting as my senior DevOps engineer) to give me one interview-style question each day. I try to answer in English based on what I know, and then improve my explanation through feedback and correction.

Here’s today’s question and my answer:


Question

What tool do you use to check if a pod is healthy?


My First Answer (Raw)

There are two options to check pod's health, which are readiness probe and liveness probe. First, readiness probe is literally the option that determine whether the pod can receive traffic. If it fails, the pod shouldn't receive traffic anymore, so kube proxy eliminates it's endpoint from service. Liveness probe is literally the option which check whether the pod is alive. If the pod is running but it can not behave properly for any reason, kubelet restarts it. With their nature in my mind, they should run repeateadly in a pod's lifecycle. However, It's important to note that they are mutually independent. It's possible to pass the liveness check but readiness check, or vice verca. So you should pay attention configuring liveneas check. Because it is possible for the pod can't be ready forever because the kubelet restarts the pod before readiness probe succeeds.
You can prepare this kind of accident using startup probe. It ensures if the pod is ready to accept readiness and liveness check. if the pod have long warming up process, it's useful to configure startup probe to delay readiness and liveness check.


Refined Answer (with feedback)

There are two main mechanisms to check a pod’s health: the readiness probe and the liveness probe.

The readiness probe determines whether a pod is ready to receive traffic.
If it fails, the pod is removed from the service’s endpoints by kube-proxy, so that no traffic is routed to it.

The liveness probe, on the other hand, checks whether the pod is still alive.
Even if the container is technically running, the kubelet will restart it if the liveness probe fails repeatedly—assuming it's no longer functioning properly.

Because of their nature, both probes typically run repeatedly throughout a pod's lifecycle.
It's important to note, however, that these probes operate independently:
a pod may pass one while failing the other.

This can be problematic—especially if the liveness probe is too aggressive.
In such cases, the pod might get restarted before it even has a chance to become ready, causing it to remain in a perpetual unready state.

To handle this, you can configure a startup probe, which is designed to delay the execution of readiness and liveness checks until the application has finished initializing.
For pods with a long startup time, this is an effective way to prevent premature restarts and ensure proper lifecycle management.

Top comments (0)