<p>I have pods that are of kind <code>Cronjob</code> running in parallel. They complete task and run again after fixed interval of 20 minutes as per cron expression. I noticed that some pods are restarting 2-3 times before completing task.</p>
<p>I checked details in <code>kubectl describe pod</code> command and found that pod <code>exit code 2</code> when it restart due to some error:</p>
<pre><code>Last State:     Terminated
      Reason:       Error
      Exit Code:    2
</code></pre>
<p>I searched about exit code 2 and found that it is misuse of a <code>shell builtin commands</code>. How I can find which shell builtin is misused. How to debug cause of exit code 2.</p>
<p>Thanks in advance.</p>

anujprashar
<p>An exit code of 2 indicates either that the application chose to return that error code, or (by convention) there was a misuse of a shell built-in. Check your pod’s command specification to ensure that the command is correct. If you think it is correct, try running the image locally with a shell and run the command directly.</p>
<p>Refer to this <a href="https://www.datree.io/resources/kubernetes-error-codes-crashloopbackoff" rel="nofollow noreferrer">link</a> for more information.</p>
