Manish Khandelwal
Manish Khandelwal

Reputation: 2310

How to get iostats of a container running in a pod on Kubernetes?

Memory and cpu resources of a container can be tracked using prometheus. But can we track I/O of a container? Are there any metrices available?

Upvotes: 3

Views: 1702

Answers (1)

Mikołaj Głodziak
Mikołaj Głodziak

Reputation: 5267

If you are using Docker containers you can check the data with the docker stats command (as P... mentioned in the comment). Here you can find more information about this command.

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

For more look at this similar question. Here you can find another interesting question. You should know, that

Containers inside pods partially share /procwith the host system include path about a memory and CPU information.

See also this article about Memory inside Linux containers.

Upvotes: 1

Related Questions