<p>I have my deployment, where I have defined postgres statefulSet, however I have it without PVC so if pod is dead - all data is gone. If I will list all pods I see below picture:</p>

<pre><code>pod1 - Running - 10 min
pod2 - Running - 10 min
postgresPod - Running - 10 min
</code></pre>

<p>After some time I list pods again and see below:</p>

<pre><code>pod1 - Running - 10 min
pod2 - Running - 10 min
postgresPod - Running - 5 min
</code></pre>

<p>As you can see postgresPod running 5 min. I "described" statefulset and see there below:</p>

<pre><code>Type     Reason               Age                From                    Message
  ----     ------               ----               ----                    -------
  Normal   SuccessfulCreate     5m **(x2 over 10m)**  statefulset-controller  create Pod postgresPod in StatefulSet x-postgres successful
  Warning  RecreatingFailedPod  5m                statefulset-controller  StatefulSet xx/x-postgres is recreating failed Pod postgresPod
  Normal   SuccessfulDelete     5m                statefulset-controller  **delete Pod postgresPod** in StatefulSet x-postgres successful
</code></pre>

<p>So my question is how I can know <strong>why</strong> statefulSet recreates the pods? Is there any additional log? Might be it is somehow related to resources of the machines, or pod was created on another node that has more resources on that specific moment?</p>

<p>Any Ideas?</p>

liotur
<p>Another nifty little trick I came up with is to <code>describe</code> the pod as soon as it stops logging, by using</p>
<pre><code>kubectl logs -f mypod &amp;&amp; kubectl describe pod mypod
</code></pre>
<p>When the pod fails and stops logging, the <code>kubectl logs -f mypod</code> will terminate and then the shell will immediately execute <code>kubectl describe pod mypod</code>, (hopefully) letting you catch the state of the failing pod before it is recreated.</p>
<p>In my case it was showing</p>
<pre><code>    Last State:     Terminated
      Reason:       OOMKilled
      Exit Code:    137
</code></pre>
<p>in line with what Timothy is saying</p>
