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

Updated:   |  OpenShift articles

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.

    Environment:
      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



Comments


Add a Comment


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