FreeKB - OpenShift View a pods memory (RAM oc edit)
OpenShift - View a pods memory (RAM oc edit)

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

 

The oc get pods command with the -o yaml option can be used to determine how much memory (RAM) has been allocated for the pod.

oc get pod/pod001 -o yaml

 

Something like this should be returned. In this example, the pod has 512 MB of memory allocated.

spec:
  containers:
  - env:
    resources:
      requests:
        memory: 512Mi

 

The oc exec command can be used to get the real time memory usage in bytes of the pod.

oc exec pod001 -- cat /sys/fs/cgroup/memory/memory.usage_in_bytes

 

Something like this should be returned. In this example, the pod is currently using 568414208 bytes of memory (568 MB).

568414208

 

The oc edit command can be used to change the amount of memory the pod has allocated.

oc edit pod/pod001

 

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

 



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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |