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

<p>Every example I found on kubernetes command probes gives the same kind of code: </p>

<pre><code>livenessProbe:
    exec:
      command:
      - cat
      - /tmp/healthy
</code></pre>

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

<ol>
<li>What would be other good examples of probes commands?</li>
<li>How will kubernetes determine if the result of the command is a success or a failure?</li>
</ol>

OLIVIER
<p>You can pass any command as an <code>exec</code> probe.</p>

<p>The healthy of the container is <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-liveness-command" rel="nofollow noreferrer">determined by the exit code</a>. If the command succeeds, it returns <code>0</code>, and the <code>kubelet</code> considers the Container to be alive and healthy. Anything different than exit code <code>0</code> is considered unhealthy.</p>

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

<p>Examples:</p>

<ul>
<li><a href="https://github.com/helm/charts/blob/6b3367d471b789900526a0e2ecc0bafa8aeb4d5a/stable/rabbitmq/templates/statefulset.yaml#L152" rel="nofollow noreferrer">RabbitMQ</a>: Provides the <code>rabbitmq-api-check</code></li>
<li><a href="https://github.com/helm/charts/blob/6b3367d471b789900526a0e2ecc0bafa8aeb4d5a/stable/postgresql/templates/statefulset.yaml#L175" rel="nofollow noreferrer">PostgreSQL</a>: Provides the <code>pg_isready</code></li>
<li><a href="https://github.com/helm/charts/blob/6b3367d471b789900526a0e2ecc0bafa8aeb4d5a/stable/mysql/templates/deployment.yaml#L120" rel="nofollow noreferrer">MySQL</a>: Provides the <code>mysqladmin ping</code></li>
</ul>

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