OpenShift - Update a pods max heap (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 pod has 256 MB of memory allocated for the initial / minimum heap and 512 MB of max memory for the heap.

      JAVA_OPTS: -Xmx512m -Xms256m



If the application is redeployed, the pod will have the initial / minimum and maximum heap set to whatever is defined by the deployment, thus editting the pod should be considered a temporary solution, and the JSON or YAML file used to deploy the application should be updated to whatever is the desired innitial / minimum and maximum heap.

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

oc edit pod/pod001


Let's say you update the pod to have 256 MB of memory allocated for the heap.

JAVA_OPTS: -Xmx256m -Xms256m


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 b480b in the box below so that we can be sure you are a human.


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