<p>When JVM crashes with <code>OutOfMemoryError</code> there are some options to store a dump:</p>
<pre><code>-XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=./java_pid&lt;pid&gt;.hprof
</code></pre>
<p>but what does it happen in kubernetes cluster after crashing? It seems kubernetes will clean up everything related to the pod crushed? How can I save it?</p>

J.J. Beam
<p>just mount it as a volume.</p>
<pre><code>volumeMounts:
        - name: heap-dumps
          mountPath: /dumps
      volumes:
      - name: heap-dumps
        emptyDir: {}
</code></pre>
<p><a href="https://danlebrero.com/2018/11/20/how-to-do-java-jvm-heapdump-in-kubernetes/" rel="nofollow noreferrer">How to do a java heap dump in K8s</a></p>
