doucuodan0897 2019-07-23 08:31
浏览 1293

如何获得Kubernetes上Pod的实际和实际存储使用情况?

Is there any straight-forward way to get the actual storage usage of pods on Kubernetes?

I've tried to do so using Prometheus, but only the amount of storage allocated to every pod is exposed, not what is really consumed by my application (pods).

I need a way to see how much storage every pod is consuming and reporting that to Prometheus or Grafana.

  • 写回答

2条回答 默认 最新

  • drhib62644 2019-07-23 09:53
    关注

    There is a way but it might not be a 'straight forward' one. If pods are running in Linux you can execute:

    kubectl exec -it <pod> cat /proc/1/io
    

    It will return stats regarding the main IO processes. Here is the description of those:

    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.
    

    You can also get info regarding disk usage of a particular container. It was already described here.

    Please let me know if that helped.

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度