• 开发
  • 查询node metric接口返回异常

我们的部署中有3个集群节点以及1个边缘节点,在调用接口https://www.kubesphere.io/kapis/monitoring.kubesphere.io/v1alpha3/nodes时,返回所有4个节点的监控指标,在过滤掉value为空的指标后,得到边缘节点的指标如下:

"edgenode-zoo": {
    "node_pod_count": "4",
    "node_pod_quota": "110",
    "node_pod_running_count": "4",
    "node_pod_utilisation": "0.03636363636363636"
}

但是如果在调用接口时,加上query参数resources_filter=edgenode-zoo来限制只查询边缘节点的指标,得到结果如下:

"edgenode-zoo": {
    "node_cpu_total": "4",
    "node_cpu_usage": "0.067",
    "node_cpu_utilisation": "0.01675",
    "node_memory_total": "8271167488",
    "node_memory_usage_wo_cache": "4904275968",
    "node_memory_utilisation": "0.5929363629880832",
    "node_pod_count": "4",
    "node_pod_quota": "110",
    "node_pod_running_count": "4",
    "node_pod_utilisation": "0.03636363636363636"
}

想请问一下这是为什么?是接口做了什么限制吗?

    Schenk75

    可能是个边缘节点监控的 bug,可以读下源码; 推荐使用上 metrics_filter 指定指标名称;