<p>I have a question regarding the timeout in exec type container probe in openshift/kubernetes.
My openshift version is 3.11 which has kubernetes version 1.11</p>
<p>I have defined a readiness probe as stated below</p>
<pre><code>readinessProbe:
  exec:
    command:
    - /bin/sh
    - -c
    - check_readiness.sh
  initialDelaySeconds: 30
  periodSeconds: 30
  failureThreshold: 1
</code></pre>
<p>according to openshift documentation timeoutSeconds parameter has no effect on the container probe for exec type probe.
check_readiness.sh script is a long running script and may take more than 5 mins to return.
After the container start i logged into the container to check the status of the script.
What i found is that after approx 2 min another check_readiness.sh script was started while the first one was still running and another one after approx 2 min.</p>
<p>Can someone explain what openshift or kubernetes doing with the probe in this case ?</p>

dsingh
<p>Yes, that is correct, Container Execution Checks do not support the <code>timeoutSeconds</code> argument. However, <a href="https://docs.openshift.com/container-platform/3.11/dev_guide/application_health.html" rel="nofollow noreferrer">as the documentation notes</a>, you can implement similar functionality with the <code>timeout</code> command:</p>
<pre><code>[...]
      readinessProbe:
        exec:
          command:
            - /bin/bash
            - '-c'
            - timeout 60 /opt/eap/bin/livenessProbe.sh 
        periodSeconds: 10
        successThreshold: 1
        failureThreshold: 3
[...]
</code></pre>
<p>So in your case I am guessing the following is happening:</p>
<ul>
<li>Your container is started.</li>
<li>After the duration <code>initialDelaySeconds</code> (30 seconds in your case), the first readiness probe is started and your script is executed.</li>
<li>Then, after <code>periodSeconds</code> (30s) the next probe is launched, in your case leading to the script being executed the second time.</li>
<li>Every 30s, the script is started again, even though the previous iteration(s) are still running.</li>
</ul>
<p>So in your case you should either use the <code>timeout</code> command as seen in the documentation or increase the <code>periodSeconds</code> to make sure the two scripts are not executed simultaneously.</p>
<p>In general, I would recommend that you make sure your readiness-check-script returns much faster than multiple minutes to avoid these kind of problems.</p>
