<p>What are the defaults for the Kubernetes <code>CrashLoopBackOff</code>?</p>
<p>Say, I have a pod:</p>
<pre><code>kubectl run mynginx --image nginx -- echo hello
</code></pre>
<p>And I inspect its status:</p>
<pre><code>kubectl get pods -w
NAME      READY   STATUS    RESTARTS   AGE
mynginx   0/1     Pending   0          0s
mynginx   0/1     Pending   0          0s
mynginx   0/1     ContainerCreating   0          0s
mynginx   0/1     Completed           0          2s
mynginx   0/1     Completed           1          4s
mynginx   0/1     CrashLoopBackOff    1          5s
mynginx   0/1     Completed           2          20s
mynginx   0/1     CrashLoopBackOff    2          33s
mynginx   0/1     Completed           3          47s
mynginx   0/1     CrashLoopBackOff    3          59s
mynginx   0/1     Completed           4          97s
mynginx   0/1     CrashLoopBackOff    4          109s
</code></pre>
<p>This is &quot;expected&quot;. Kubernetes starts a pod, it quits &quot;too fast&quot;, Kubernetes schedules it again and then Kubernetes sets the state to <code>CrashLoopBackOff</code>.</p>
<p>Now, if i start a pod slightly differently:</p>
<pre><code>kubectl run mynginx3 --image nginx -- /bin/bash -c &quot;sleep 10; echo hello&quot;
</code></pre>
<p>I get the following</p>
<pre><code>kubectl get pods -w
NAME       READY   STATUS    RESTARTS   AGE
mynginx3   0/1     Pending   0          0s
mynginx3   0/1     Pending   0          0s
mynginx3   0/1     ContainerCreating   0          0s
mynginx3   1/1     Running             0          2s
mynginx3   0/1     Completed           0          12s
mynginx3   1/1     Running             1          14s
mynginx3   0/1     Completed           1          24s
mynginx3   0/1     CrashLoopBackOff    1          36s
mynginx3   1/1     Running             2          38s
mynginx3   0/1     Completed           2          48s
mynginx3   0/1     CrashLoopBackOff    2          62s
mynginx3   1/1     Running             3          75s
mynginx3   0/1     Completed           3          85s
mynginx3   0/1     CrashLoopBackOff    3          96s
mynginx3   1/1     Running             4          2m14s
mynginx3   0/1     Completed           4          2m24s
mynginx3   0/1     CrashLoopBackOff    4          2m38s
</code></pre>
<p>This is also expected.</p>
<p>But say I set <code>sleep</code> for 24 hours, would I still get the same <code>CrashLoopBackOff</code> after two pod exits initially and then after each next pod exit?</p>

Maksim Sorokin
<p>Based on <a href="https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#restart-policy" rel="nofollow noreferrer">these docs</a>:</p>
<blockquote>
<p>The restartPolicy applies to all containers in the Pod. restartPolicy only refers to restarts of the containers by the kubelet on the same node. After containers in a Pod exit, the kubelet restarts them with an exponential back-off delay (10s, 20s, 40s, …), that is capped at five minutes. Once a container has executed for 10 minutes without any problems, the kubelet resets the restart backoff timer for that container.</p>
</blockquote>
<p>I think that means that anything that executes for longer than 10 minutes before exiting will not trigger a <code>CrashLoopBackOff</code> status.</p>
