I am trying to get the stats of the containers that are running inside the kubernetes nodes via docker stats command. But unfortunately I am getting all the values as "0" for all the pod containers.
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
7dc5af9923b2 0.00% 0 B / 0 B 0.00% 0 B / 0 B 0 B / 0 B 0
I did the same with containers that I brought up manually via docker run command in the same node and I am getting proper values for those containers.
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
8be93c039a25 0.12% 133.3 MB / 3.892 GB 3.43% 0 B / 648 B 2.208 MB / 0 B 0
Is there any specific method to get the stats fot the pod containers other than this?
Note: docker version is 1.11.2 and kube version is 1.3.7
I resolved this one. I used the kubelet API to get the metrics for the node and well as for individual containers. The following API will return the metrics for a pod container.
http://<nodeIP>:10255/stats/<podName>/<containerName> - POST
This post that was suggested in the comments was much helpful.
This document has some more APIs to collect the metrics.