docker stats not shows ZERO Net I/O for the containers that are streaming video

7/25/2019

I have created a Kubernetes Cluster of Physical Machine and VMs. The containers deployed are displaying the values for Memory and CPU but Network I/O values are ZERO/ZERO although I am streaming video from the containers. There are some PAUSE containers created against each container on POD, they are also showing 0/0 Net I/O.

I tried to get the data through cadvisor but it also doesnt show the data for network I/O for the running containers.

CONTAINER ID        NAME                                                                                                                CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
ce0eebabe881        k8s_video_hello-world-5c78949d4d-mpzqh_default_5d0b8e18-1419-4c5b-9aef-25627fcf2e0c_0                               0.02%               19.82MiB / 15.59GiB   0.12%               0B / 0B             0B / 0B             1
0a47b078ba26        k8s_video_hello-world-5c78949d4d-xfvcz_default_b8ec6c0a-ffe3-4f77-ae97-e0a6b162e078_0                               0.02%               20.35MiB / 15.59GiB   0.13%               0B / 0B             0B / 0B             1
d68827bc3a8e        k8s_video_hello-world-5c78949d4d-h95kq_default_9086a833-e3e1-410e-98bb-8db11314bf65_0                               0.03%               19.32MiB / 15.59GiB   0.12%               0B / 0B             0B / 0B             1
80130bc836ac        k8s_video_hello-world-5c78949d4d-hc7hx_default_77dcf557-8450-47c3-91d0-52369c7c37ac_0                               0.02%               19.6MiB / 15.59GiB    0.12%               0B / 0B             0B / 0B             1
37392f5c807b        k8s_POD_hello-world-5c78949d4d-mpzqh_default_5d0b8e18-1419-4c5b-9aef-25627fcf2e0c_0                                 0.00%               1.281MiB / 15.59GiB   0.01%               0B / 0B             0B / 0B             1
1736a8064c72        k8s_POD_hello-world-5c78949d4d-h95kq_default_9086a833-e3e1-410e-98bb-8db11314bf65_0                                 0.00%               1.508MiB / 15.59GiB   0.01%               0B / 0B             0B / 0B             1
aef03f775aeb        k8s_POD_hello-world-5c78949d4d-xfvcz_default_b8ec6c0a-ffe3-4f77-ae97-e0a6b162e078_0                                 0.00%               944KiB / 15.59GiB     0.01%               0B / 0B             0B / 0B             1
a89c5c6399b1        k8s_POD_hello-world-5c78949d4d-hc7hx_default_77dcf557-8450-47c3-91d0-52369c7c37ac_0                                 0.00%               1.379MiB / 15.59GiB   0.01%               0B / 0B             0B / 0B             1

When I ran Docker stats for containers deployed on swarm, the Docker Stats and cadvisor was working fine.

-- Awais
docker
kubernetes

1 Answer

7/26/2019

If package ifconfig in present in your image they you can always do

kubectl exec <pod_name> ifconfig

output might looks like the following:

eth0      Link encap:Ethernet  HWaddr DA:6E:42:4F:87:EE
          inet addr:10.8.1.9  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::d86e:42ff:fe4f:87ee/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1460  Metric:1
          RX packets:1282 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1296 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:122059 (119.1 KiB)  TX bytes:122960 (120.0 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Now on explain why docker stats won't work.

Kubernetes doesn't use Docker networking, it uses CNI - Container Network Interface.

A CNI plugin is responsible for inserting a network interface into the container network namespace (e.g. one end of a veth pair) and making any necessary changes on the host (e.g. attaching the other end of the veth into a bridge). It should then assign the IP to the interface and setup the routes consistent with the IP Address Management section by invoking appropriate IPAM plugin.

I strongly advice you to read @Ian Lewis blog What are Kubernetes Pods Anyway?

If you would like to know more about networking I recommend great read of Kubernetes Networking: Behind the scenes by @Nicolas Leiva.

I hope this will sheds some light on the subject.

-- Crou
Source: StackOverflow