From a5f9477fb78fbd2298e4642fc614cd414f47683a Mon Sep 17 00:00:00 2001 From: AdamDang Date: Wed, 2 Jan 2019 16:32:38 +0800 Subject: [PATCH] zh-trans:/docs/tasks/debug-application-cluster/core-metrics-pipeline.md (#11990) zh-trans:/docs/tasks/debug-application-cluster/core-metrics-pipeline.md --- .../core-metrics-pipeline.md | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 content/zh/docs/tasks/debug-application-cluster/core-metrics-pipeline.md diff --git a/content/zh/docs/tasks/debug-application-cluster/core-metrics-pipeline.md b/content/zh/docs/tasks/debug-application-cluster/core-metrics-pipeline.md new file mode 100644 index 0000000000..9f9d04a988 --- /dev/null +++ b/content/zh/docs/tasks/debug-application-cluster/core-metrics-pipeline.md @@ -0,0 +1,120 @@ +--- +reviewers: +- fgrzadkowski +- piosz +title: 核心指标传递管道 +content_template: templates/concept +--- + + + +{{% capture overview %}} + + + +从 Kubernetes 1.8 版本开始,用户在 Kubernetes 中可以通过度量 API 获取资源使用度量(如容器 CPU 和内存使用率)。 +这些度量可以由用户直接访问,例如使用 `kubectl top` 命令,也可以由集群中的控制器(例如 Pod 水平自动扩缩器)用来做决策。 + +{{% /capture %}} + + +{{% capture body %}} + + + +## 度量 API + + + +通过度量 API,您可以获得给定节点或给定 Pod 当前使用的资源数量。 +此 API 不存储度量值,因此不可能获得 10 分钟前给定节点使用的资源数量。 + + + +度量 API 和其他 API 没有什么不同: + + + +- 它可通过与 `/apis/metrics.k8s.io/` 路径下的其他 Kubernetes API 相同的端点来发现 +- 它提供相同的安全性、可扩展性和可靠性保证 + + + + +度量 API 是在 [k8s.io/metrics](https://github.com/kubernetes/metrics/blob/master/pkg/apis/metrics/v1beta1/types.go) 仓库进行定义的。您可以在那里找到该 API 相关的更多信息。 + +{{< note >}} + +度量 API 要求在集群中部署度量服务器。否则它将不可用。 +{{< /note >}} + + + +## 度量服务器 + + + +[指标服务器](https://github.com/kubernetes-incubator/metrics-server)是集群范围内的资源使用数据的聚合器。 +从 Kubernetes 1.8 版本开始,它作为部署对象默认部署在由 `kube-up.sh` 脚本创建的集群中。 +如果您使用了不同的 Kubernetes 安装机制,则可以使用提供的[部署 yaml](https://github.com/kubernetes孵化器/metrics-server/tree/master/deploy)。 +它在 Kubernetes 1.7 以上版本中被支持(请参见下面的详细信息)。 + + + + +度量服务器通过 Summary API 获取度量值,该 API 由 [Kubelet](/docs/admin/kubelet/) 在每个节点上进行暴露。 + + + +度量服务器通过 [Kubernetes 聚合器](https://kubernetes.io/docs/concepts/api-extension/apiserver-aggregation/)在主 API 服务器中注册,该聚合器是在 Kubernetes 1.7 版本中引入的。 + + + + +进一步了解度量服务器请参考[设计文档](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/metrics-server.md)。 + +{{% /capture %}}