Kubernetes collects lots of metrics data regarding the resources usage within the cluster (cpu, memory, network, disk). In this article, we will be focusing on the various memory metrics that are collected by cAdvsior and which ones cause OOMkill whenever we apply memory limits to the pods.
When you execute inside your container and navigate to the following directory, you will find all the container’s memory information you may need. The usage, limits, cache, number of times your container got OOMKilled, e.t.c will all be found in this directory:
cd /sys/fs/cgroups/memory/
Copy
The following control files will be gotten whenever the content of this directory is listed out:
root@test-8589C7679b-bfjrn:/sys/fs/cgroup/memory## ls
cgroup.clone_children memory.kmem.limit_in_bytes memory.kmem.tcp.Usage_in_bytes memory.oom_control memory.use_hierarchy
cgroup.event_control memory.kmem.max_usage_in_bytes memory.kmem.usage_in_bytes memory.pressure_level notify_on_release
cgroup.procs memory.kmem.slabinfo memorylimit_in_bytes memory.soft_limit_in_bytes tasks
memory.failcnt memory.kmem.tcp.failcnt memory.max_usage_in_bytes memory.stat
memory.force_empty memory.kmem.tcp.limit_in_bytes memory.move_charge_at_immigrate memory.swappiness
memory.kmen.failcnt memory.kmem.tcp.max_usage_in_bytes memory.numa_stat memory.usage_in_bytes
Copy
Each file contains a piece of information about the memory. You can read more about them here.
#devops #kubernetes #write-for-cloud-native #memory metrics