Kubernetes:如何获取节点的磁盘/CPU指标 [英] Kubernetes: How to get disk / cpu metrics of a node

查看:1078
本文介绍了Kubernetes:如何获取节点的磁盘/CPU指标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果不使用Heapster,是否有任何方法可以收集有关Kubernetes集群中某个节点的CPU或磁盘度量标准?

Without using Heapster is there any way to collect like CPU or Disk metrics about a node within a Kubernetes cluster?

Heapster首先如何收集这些指标?

How does Heapster even collect those metrics in the first place?

推荐答案

Kubernetes监视在文档此处,但这主要涵盖了使用堆积器的工具.

Kubernetes monitoring is detailed in the documentation here, but that mostly covers tools using heapster.

特定于节点的信息通过cAdvisor UI公开,可以在端口4194上进行访问(请参阅下面的命令以通过代理API进行访问).

Node-specific information is exposed through the cAdvisor UI which can be accessed on port 4194 (see the commands below to access this through the proxy API).

Heapster向kubelet查询在<kubelet address>:10255/stats/处提供的统计信息(其他端点可以在代码

Heapster queries the kubelet for stats served at <kubelet address>:10255/stats/ (other endpoints can be found in the code here).

尝试一下:

$ kubectl proxy &
Starting to serve on 127.0.0.1:8001
$ NODE=$(kubectl get nodes -o=jsonpath="{.items[0].metadata.name}")
$ curl -X "POST" -d '{"containerName":"/","subcontainers":true,"num_stats":1}' localhost:8001/api/v1/proxy/nodes/${NODE}:10255/stats/container
...

请注意,这些端点没有记录在案,因为它们仅供内部使用(和调试),并且将来可能会更改(我们最终希望提供一个更稳定的版本化端点).

Note that these endpoints are not documented as they are intended for internal use (and debugging), and may change in the future (we eventually want to offer a more stable versioned endpoint).

更新:

从Kubernetes 1.2版开始,Kubelet导出一个摘要" API,该API汇总了所有Pod的统计信息:

As of Kubernetes version 1.2, the Kubelet exports a "summary" API that aggregates stats from all Pods:

$ kubectl proxy &
Starting to serve on 127.0.0.1:8001
$ NODE=$(kubectl get nodes -o=jsonpath="{.items[0].metadata.name}")
$ curl localhost:8001/api/v1/proxy/nodes/${NODE}:10255/stats/summary
...

这篇关于Kubernetes:如何获取节点的磁盘/CPU指标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆