Go 如何获得真实的&;Kubernetes上吊舱的实际存储使用情况?

Go 如何获得真实的&;Kubernetes上吊舱的实际存储使用情况?,go,kubernetes,storage,Go,Kubernetes,Storage,有没有直接的方法来获取Kubernetes上吊舱的实际存储使用量 我曾尝试使用Prometheus来实现这一点,但只公开分配给每个pod的存储量,而不是我的应用程序(pod)真正消耗的存储量 我需要一种方法来查看每个豆荚消耗了多少存储空间,并报告给普罗米修斯或格拉法纳。有一种方法,但它可能不是一种“直接”的方法。 如果POD在Linux中运行,您可以执行: kubectl exec -it <pod> cat /proc/1/io kubectl exec-it cat/proc/

有没有直接的方法来获取Kubernetes上吊舱的实际存储使用量

我曾尝试使用Prometheus来实现这一点,但只公开分配给每个pod的存储量,而不是我的应用程序(pod)真正消耗的存储量


我需要一种方法来查看每个豆荚消耗了多少存储空间,并报告给普罗米修斯或格拉法纳。

有一种方法,但它可能不是一种“直接”的方法。 如果POD在Linux中运行,您可以执行:

kubectl exec -it <pod> cat /proc/1/io
kubectl exec-it cat/proc/1/io
它将返回有关主IO进程的统计信息。以下是对这些问题的描述:

rchar
-----

I/O counter: chars read
The number of bytes which this task has caused to be read from storage. This
is simply the sum of bytes which this process passed to read() and pread().
It includes things like tty IO and it is unaffected by whether or not actual
physical disk IO was required (the read might have been satisfied from
pagecache)


wchar
-----

I/O counter: chars written
The number of bytes which this task has caused, or shall cause to be written
to disk. Similar caveats apply here as with rchar.


read_bytes
----------

I/O counter: bytes read
Attempt to count the number of bytes which this process really did cause to
be fetched from the storage layer. Done at the submit_bio() level, so it is
accurate for block-backed filesystems. <please add status regarding NFS and
CIFS at a later time>


write_bytes
-----------

I/O counter: bytes written
Attempt to count the number of bytes which this process caused to be sent to
the storage layer. This is done at page-dirtying time.
rchar
-----
I/O计数器:读取字符
此任务导致从存储器中读取的字节数。这
只是此进程传递给read()和pread()的字节之和。
它包括tty IO之类的东西,不受实际情况的影响
需要物理磁盘IO(读取可能已满足
页面缓存)
wchar
-----
I/O计数器:已写入字符
此任务已导致或将导致写入的字节数
到磁盘。类似的警告适用于rchar。
读取字节
----------
I/O计数器:读取字节数
尝试计算此进程实际导致的字节数
可以从存储层获取。在submit_bio()级别完成,因此
对于块备份的文件系统来说是准确的。
写入字节
-----------
I/O计数器:写入的字节数
尝试计算此进程导致发送到的字节数
存储层。这是在页面弄脏时完成的。
您还可以获取有关特定容器的磁盘使用情况的信息。已经描述过了

如果有帮助,请告诉我。

这很棘手, 普罗米修斯正在收集一些库贝莱指标,并刚刚创建了一个带有以下参数的grafana仪表盘,并且工作正常: 查询: kubelet_体积_统计数据_已用字节/kubelet_体积_统计数据_容量_字节*100 格拉凡纳传奇: {{namespace}}{{persistentvolumeclaim}}