OpenShift - Configure a pod to create heap dumps (oc edit JAVA_OPTS)

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

A node contains one or more pods, and each pod contains one or more containers.


The oc describe pod/pod_name command can be used to view a pods configuration.

oc describe pod/pod001


Something like this should be returned, in the JSON format by default. Notice in this example the JAVA_OPTS contains -Xmx512m and -Xms256m, meaning that the pods has 512 MB of memory allocated for the heap and 256 MB of memory allocated for metaspace.

      JAVA_OPTS: -Xmx512m -Xms256m


The oc edit command can be used to edit the pods configuration.

oc edit pod/pod001


Here are the additional options you would add so that the pod will create a heap dump when an out of memory event occurs.


JAVA_OPTS: -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/dumps


After this change has been made, you will want to restart the pod (scale down, then up) for this change to take effect.

Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter 2a8d9 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |