Liberty in OpenShift Get Heapdump Recipe

  1. Ensure you're logged in with oc
  2. Find the relevant pod(s):
    $ oc get pods --namespace $NAMESPACE
    NAME                            READY   STATUS    RESTARTS   AGE
    mypod-7d57d6599f-tq7vt          1/1     Running   0          12m
  3. Remote into the pod (if it has more than one container, specify the container with -c $CONTAINER):
    $ oc rsh --namespace $NAMESPACE -t $PODNAME
    sh-4.4$ 
  4. Execute server javadump with the heapdump option. The $WLP path is usually either /opt/ibm/wlp or /opt/ol/wlp depending on whether it's WebSphere Liberty or OpenLiberty, respectively:
    $WLP/bin/server javadump --include=heap
  5. Exit the remote shell:
    exit
  6. Download the output directory that has the heapdump (replace $WLP as in step 4):
    oc cp --namespace $NAMESPACE $PODNAME:$WLP/output/defaultServer libertyoutput
  7. Zip and upload the libertyoutput directory