崩溃后内存转储如何保存在kubernetes集群中?

How could be memory dump saved in kubernetes cluster after crashing?

当 JVM 因 OutOfMemoryError 崩溃时,有一些选项可以存储转储:

-XX:+HeapDumpOnOutOfMemoryError 
-XX:HeapDumpPath=./java_pid<pid>.hprof

但是kubernetes集群崩溃后发生了什么?好像kubernetes会清理所有与粉碎的pod有关的东西?我该如何保存?

只需将其挂载为一个卷即可。

volumeMounts:
        - name: heap-dumps
          mountPath: /dumps
      volumes:
      - name: heap-dumps
        emptyDir: {}

How to do a java heap dump in K8s