Reputation: 875
Please provide a simple step by step guide to looking into java heap dump from a Kubernetes pod.
Upvotes: 21
Views: 62057
Reputation: 153
jmap is part of JDK not JRE. The production image are usually built on JRE and not JDK to reduce size of image. If you need to debug, you need to update the image to JDK based and debug then later once the issue is identified, can revert back to JRE based image.
In my case, I did the same thing to generate the dump.
Upvotes: 2
Reputation: 875
kubectl exec -it herle-deployment-pod-5757d89d85-wrpc9 bash
get the process id (top command)
Create java heap dump
jmap -dump:live,format=b,file=<file_name>.bin <process_id>
Example:
jmap -dump:live,format=b,file=application_heap_dump.bin 1
kubectl cp <pod_name>:<heap_file> <your local destination directory>
Example:
kubectl cp herle-deployment-pod-5757d89d85-wrpc9:/tmp/application_heap_dump.bin /Users/amritharajherle/Desktop/application_heap_dump.bin
Upvotes: 29