在 kubernetes pod 中出现 OOM 时保留堆转储吗?
当 java 进程出现 OOM 且 pod 重新启动时,我需要保留堆转储。
我在 jvm args 中添加了以下内容
-XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/dumps
...并且emptydir安装在同一路径上。
但问题是,如果 Pod 重新启动并且它被安排在不同的节点上,那么我们就会丢失堆转储。即使 pod 被安排到不同的节点,如何保留堆转储?
我们正在使用 AWS EKS,并且我们有超过 1 个 Pod 副本。
有人可以帮忙解决这个问题吗?
I need to persist the heap dump when the java process gets OOM and the pod is restarted.
I have following added in the jvm args
-XX:+ExitOnOutOfMemoryError -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/dumps
...and emptydir is mounted on the same path.
But the issue is if the pod gets restarted and if it gets scheduled on a different node, then we are losing the heap dump. How do I persist the heap dump even if the pod is scheduled to a different node?
We are using AWS EKS and we are having more than 1 replica for the pod.
Could anyone help with this, please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于在您的情况下写入 EFS 太慢,因此 AWS EKS 还有另一种选择 -
awsElasticBlockStore
。注意:您必须先使用 aws ec2 create-volume 或 AWS API 创建 EBS 卷,然后才能使用它。
使用 awsElasticBlockStore 卷时有一些限制:
检查k8s 官方文档请访问有关此主题的页面。
以及如何在 EKS 中使用持久存储。
As writing to EFS is too slow in your case, there is another option for AWS EKS -
awsElasticBlockStore
.Note: You must create an EBS volume by using aws ec2 create-volume or the AWS API before you can use it.
There are some restrictions when using an awsElasticBlockStore volume:
Check the official k8s documentation page on this topic, please.
And How to use persistent storage in EKS.
您必须将堆转储保留在 Pod 之间的共享网络位置上。为了实现这一点,您需要提供持久卷声明,在 EKS 中,这可以使用安装在不同可用区域上的弹性文件系统来实现。您可以通过阅读这份关于 EFS 的指南来开始了解它 -基于PVC。
You will have to persists the heap dumps on a shared network location between the pods. In order to achieve this, you will need to provide persistent volume claims and in EKS, this could be achieved using an Elastic File System mounted on different availability zones. You can start learning about it by reading this guide about EFS-based PVCs.