4

I want to see current memory usage of PODs. I tried "oc get pods | grep elastic-*" to get POD details

elastic-index-5-kwz79                                       1/1       Running   0          1h
elastic-index-5-lcfzp                                       1/1       Running   0          1h
elastic-master-0                                            1/1       Running   0          1h
elastic-master-1                                            1/1       Running   0          1h
elastic-master-2                                            1/1       Running   0          1h
elastic-query-2-wspl5                                       1/1       Running   0          1h

Table is showing status and last running details but I am looking for current memory usage and total memory details

For Example -

Name                          Total Memory         Available Memory
elastic-index-5-kwz79           1024MB                723MB
Morez
  • 2,048
  • 5
  • 36
  • 49

2 Answers2

4

If you want to check pods cpu/memory usage without installing any third party tool then you can get memory and cpu usage of pod from cgroup.

  1. Go to pod's exec mode kubectl exec pod_name -- /bin/bash
  2. Go to cd /sys/fs/cgroup/cpu for cpu usage run cat cpuacct.usage
  3. Go to cd /sys/fs/cgroup/memory for memory usage run cat memory.usage_in_bytes

NOTE: This usage is in bytes.

Dashrath Mundkar
  • 7,956
  • 2
  • 28
  • 42
3

You can check your pod's cpu and memory usage using oc adm top pods as follows. Refer Viewing Pods for more details.

$ oc adm top pods
NAME                         CPU(cores)   MEMORY(bytes)
hawkular-cassandra-1-pqx6l   219m         1240Mi
hawkular-metrics-rddnv       20m          1765Mi
heapster-n94r4               3m           37Mi
Daein Park
  • 4,393
  • 2
  • 12
  • 21