Is "cat /tmp/healthy" the only way to configure a Kubernetes command probe?

11/6/2019

I'm trying to understand exactly how kubernetes command probes work, but the documentation is quite dry on this.

Every example I found on kubernetes command probes gives the same kind of code:

livenessProbe:
    exec:
      command:
      - cat
      - /tmp/healthy

I seems possible to pass any command to the exec object. So my question is:

  1. What would be other good examples of probes commands?
  2. How will kubernetes determine if the result of the command is a success or a failure?
-- OLIVIER
kubernetes

2 Answers

11/6/2019
  1. Usually cat is one good exec command probe. But any linux command is valid.
  2. kubelet will check on the exit code ($?). 0 is healthy. Anything else is unhealthy.
-- suren
Source: StackOverflow

11/6/2019

You can pass any command as an exec probe.

The healthy of the container is determined by the exit code. If the command succeeds, it returns 0, and the kubelet considers the Container to be alive and healthy. Anything different than exit code 0 is considered unhealthy.

Some applications provide binaries/scripts that are made for health checks.

Examples:

The use of exec probe is also useful when you need to define an entire script with the logic of your expected healthiness.

-- Eduardo Baitello
Source: StackOverflow