<p>Now my kubernetes (<code>v1.15.x</code>) deployment keeps restarting all the time. From the log ouput with kubernetes dashboard I could not see anything useful. Now I want to log into the pod and check the log from log dir of my service. But the pod keeps restarting all the time and I have no chance to log into the pod.</p>
<p>Is there any way to login restart pod or dump some file or see the file in the pod? I want to find why the pod restart all the time.</p>
<p><a href="https://i.stack.imgur.com/noGBd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/noGBd.png" alt="enter image description here" /></a></p>

Dolphin
<p>if you are running the <strong>GKE</strong> and <strong>logging</strong> is enabled you can get all container log by default into the dashboard of stack driver logging.</p>
<p>As of now you can run the <code>kubectl describe pod &lt;pod name&gt;</code> to check the status code of the container which got exited. Status code might be helpful to understand the reason for restart, is it due to <strong>Error</strong> or <strong>OOM killed</strong>.</p>
<p>you can also use the flag <code>--previous</code> and get logs of restarted POD</p>
<p>Example :</p>
<pre><code>kubectl logs &lt;POD name&gt; --previous
</code></pre>
<p>in the above case of <code>--previous</code> your pod needs but still exist inside the cluster.</p>
