How to get Java heap dump from Kubernetes container into a local machine?

What is A Java heap dump?

Imagine you have a bunch of containers running your Java applications in a Kubernetes environment. Each container has its own special space where it stores and manages its memory. If something goes wrong and you suspect a memory issue, you can still use a Java heap dump to help you figure out what’s happening inside those containers. This can help you identify things like memory leaks or excessive memory usage.

Earlier one of our Java application k8s containers has been periodically running out of memory. As we realized the issue, our development team needed to analyze the memory leak of the application.
The primary goal of this article is to quickly get a heap dump at the time of crisis. I would like to explain, How we can get JVM heap memory by manual way.

Continue reading “How to get Java heap dump from Kubernetes container into a local machine?”