Skip to content

Unable to see container's metrics about external volumes attached (k8s persistent volumes) #1702

@eedugon

Description

@eedugon

Hello,

We are having a discussion at "prometheus-operator" project, and based on @brancz suggestion, we are raising the topic here, as our problem seems related with cadvisor in some way.
(this is the original thread, just in case: #prometheus-operator/prometheus-operator#485)

In a kubernetes + prometheus-operator environment we are not able to get any kind of metric about persistent volumes that are attached to containers in pods, and we don't really understand why.

Keeping out of the topic that Kubernetes should probably provide information about them, because PVs are actually K8s resources, we are wondering how we can't find any information at cadvisor/kubelet level metrics.

For example, a container might show the following disks (by df -h directly in a bash of the container):

# df -h
overlay 154G 12G 136G 9% /
/dev/xvdbg       20G   46M   19G   1% /var/lib/zookeeper (THIS IS THE PERSISTENT VOLUME)
/dev/xvda1 154G 7.2G 140G 5% /etc/hosts
...
...

In that output, the "154G" device is the main disk of the container owner (k8s node), and we have no problem finding metrics about that disk at all levels.
But the other device (/dev/xvdbg) is actually the persistent volume that is mounted in the container, and there's no track of it at all in the metrics.

container_fs_usage_bytes information about that pod/container has only:
container_fs_usage_bytes{container_name="kafka",device="/dev/xvda1",.....}
Which represents actually the physical disk of the k8s node, owning the container.
But there's noting else about /dev/xvdbg, and that's what we are looking for...

Do you have any suggestion, idea or explanation for this behavior? Are we missing something at configuration level to make kubelet reporting this?

Note1: At node level, lsblk shows the disk of the PV:

admin@node$ lsblk 
NAME    MAJ:MIN   RM  SIZE RO TYPE MOUNTPOINT
xvda    202:0      0  164G  0 disk 
`-xvda1 202:1      0  164G  0 part /
xvdbg   202:14848  0   20G  0 disk /var/lib/kubelet/pods/ae6c1d55-6d7a-11e7-bc61-068b6da15381/volumes/kubernetes.io~aws-ebs

# and it's also mounted
/dev/xvdbg       20G   46M   19G   1% /var/lib/kubelet/plugins/kubernetes.io/aws-ebs/mounts/aws/eu-west-2a/vol-0bafa0be2b20de87a

In the node we have cadvisor/kubelet metrics and also node_exporter.... none of them are reporting what we are looking for. I suspect we are missing some kind of mapping or configuration somewhere, because the disk is there...

Thanks very much in advance, any help will be appreciated,
Eduardo
(+ @hartmut-pq)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions