resolve conversation
parent
a90a5a9ae3
commit
f15184d39c
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
title: Kubernetes控制面板的指标
|
||||
title: Kubernetes 控制面板的指标
|
||||
content_template: templates/concept
|
||||
weight: 60
|
||||
---
|
||||
|
@ -14,7 +14,7 @@ Metrics in Kubernetes control plane are emitted in [prometheus format](https://p
|
|||
|
||||
系统组件的指标可以让我们更好的看清系统内部究竟发生了什么,尤其对于构建仪表盘和告警都非常有用。
|
||||
|
||||
Kubernetes控制面板中的指标是以[prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/)格式发出的,而且是易于阅读的。
|
||||
Kubernetes 控制面板中的指标是以 [prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) 格式发出的,而且是易于阅读的。
|
||||
|
||||
{{% /capture %}}
|
||||
|
||||
|
@ -25,9 +25,9 @@ Kubernetes控制面板中的指标是以[prometheus](https://prometheus.io/docs/
|
|||
In most cases metrics are available on `/metrics` endpoint of the HTTP server. For components that doesn't expose endpoint by default it can be enabled using `--bind-address` flag.
|
||||
-->
|
||||
|
||||
## Kubernetes的指标
|
||||
## Kubernetes 的指标
|
||||
|
||||
在大多数情况下,你可以在你的HTTP服务加上 `/metrics` 端点就可以查询系统的各项指标,对于那些默认不暴露端点的组件,你可以在启动的时候加上 `--bind-address` 来开启。
|
||||
在大多数情况下,指标在 HTTP 服务器的 `/metrics` 端点使用,对于默认情况下不暴露端点的组件,可以使用 `--bind-address` 参数启用。
|
||||
|
||||
<!--
|
||||
Examples of those components:
|
||||
|
@ -51,11 +51,11 @@ If your cluster uses {{< glossary_tooltip term_id="rbac" text="RBAC" >}}, readin
|
|||
For example:
|
||||
-->
|
||||
|
||||
在生产环境中,你可能需要配置 [Prometheus Server](https://prometheus.io/) 或者其他一些指标搜刮板来定期搜集这些指标,并且将他们存储在能够将他们按时间顺序排列的数据库中以便在需要的时候使用它们。
|
||||
在生产环境中,你可能需要配置 [Prometheus Server](https://prometheus.io/) 或其他指标刮板来定期收集这些指标,并使它们在某种时间序列数据库中可用。
|
||||
|
||||
请注意 {{< glossary_tooltip term_id="kubelet" text="kubelet" >}} 同样暴露了下面这些端点 `/metrics/cadvisor` , `/metrics/resource` 和 `/metrics/probes` ,而这些端点的生命周期并不一样。
|
||||
请注意 {{< glossary_tooltip term_id="kubelet" text="kubelet" >}} 同样暴露了下面这些端点 `/metrics/cadvisor`、`/metrics/resource` 和 `/metrics/probes` 端点,这些指标的生命周期并不相同。
|
||||
|
||||
如果你的集群还使用了 {{< glossary_tooltip term_id="rbac" text="RBAC" >}} ,那读取指标数据的时候,还需要通过具有ClusterRole的用户、组或者ServiceAccount来进行授权,才有权限访问 `/metrics` 。
|
||||
如果你的集群还使用了 {{< glossary_tooltip term_id="rbac" text="RBAC" >}} ,那读取指标数据的时候,还需要通过具有 ClusterRole 的用户、组或者 ServiceAccount 来进行授权,才有权限访问 `/metrics` 。
|
||||
|
||||
举例:
|
||||
|
||||
|
@ -102,7 +102,7 @@ Deprecated metric signal that the metric will eventually be deleted; to find whi
|
|||
Before deprecation:
|
||||
-->
|
||||
|
||||
弃用指标的信号表明这个指标最终将会被删除,要想查找是哪个版本,你需要检查注释,其中包括从kubernetes哪个版本开始,这个指标被废弃了。
|
||||
弃用指标的信号表明这个指标最终将会被删除,要想查找是哪个版本,你需要检查注释,其中包括该指标从哪个 kubernetes 版本被认为已弃用。
|
||||
|
||||
指标弃用前注释:
|
||||
|
||||
|
@ -148,13 +148,13 @@ Take metric `A` as an example, here assumed that `A` is deprecated in 1.n. Accor
|
|||
|
||||
## 显示隐藏指标
|
||||
|
||||
综上所述,管理员可以通过在运行可执行文件时添加一些特定的标志来开启一些隐藏的指标。当管理员错过了之前版本的的一些已弃用的指标时,这个可被视作是一个后门。
|
||||
综上所述,管理员可以通过在运行可执行文件时添加一些特定的参数来开启一些隐藏的指标。当管理员错过了之前版本的的一些已弃用的指标时,这个可被视作是一个后门。
|
||||
|
||||
`show-hidden-metrics-for-version` 标志可以指定一个版本,用来显示这个版本中被隐藏的指标。这个版本号形式是x.y,x是主要版本号,y是次要版本号。补丁版本并不是必须的,尽管在一些补丁版本中也会有一些指标会被弃用,因为指标弃用策略主要是针对次要版本。
|
||||
`show-hidden-metrics-for-version` 参数可以指定一个版本,用来显示这个版本中被隐藏的指标。这个版本号形式是x.y,x 是主要版本号,y 是次要版本号。补丁版本并不是必须的,尽管在一些补丁版本中也会有一些指标会被弃用,因为指标弃用策略主要是针对次要版本。
|
||||
|
||||
这个标志只能使用上一版本作为其值,如果管理员将上一版本设置为 `show-hidden-metrics-for-version` 的值,那么就会显示上一版本所有被隐藏的指标,太老的版本是不允许的,因为这不符合指标弃用策略。
|
||||
这个参数只能使用上一版本作为其值,如果管理员将上一版本设置为 `show-hidden-metrics-for-version` 的值,那么就会显示上一版本所有被隐藏的指标,太老的版本是不允许的,因为这不符合指标弃用策略。
|
||||
|
||||
以指标 `A` 为例,这里假设 `A` 指标在1.n版本中被弃用,根据指标弃用策略,我们可以得出以下结论:
|
||||
以指标 `A` 为例,这里假设 `A` 指标在 1.n 版本中被弃用,根据指标弃用策略,我们可以得出以下结论:
|
||||
|
||||
<!--
|
||||
* In release `1.n`, the metric is deprecated, and it can be emitted by default.
|
||||
|
@ -164,11 +164,11 @@ Take metric `A` as an example, here assumed that `A` is deprecated in 1.n. Accor
|
|||
If you're upgrading from release `1.12` to `1.13`, but still depend on a metric `A` deprecated in `1.12`, you should set hidden metrics via command line: `--show-hidden-metrics=1.12` and remember to remove this metric dependency before upgrading to `1.14`
|
||||
-->
|
||||
|
||||
* 在 `1.n`版本中,这个指标被弃用,并且默认情况下,这个指标还是可以发出.
|
||||
* 在 `1.n+1` 版本中,这个指标默认被隐藏,你可以通过设置标志 `show-hidden-metrics-for-version=1.n` 来使它可以被发出.
|
||||
* 在`1.n+2`版本中,这个指标就被从代码库中删除,也不会再有后门了.
|
||||
* 在 `1.n` 版本中,这个指标被弃用,并且默认情况下,这个指标还是可以发出.
|
||||
* 在 `1.n+1` 版本中,这个指标默认被隐藏,你可以通过设置参数 `show-hidden-metrics-for-version=1.n` 来使它可以被发出.
|
||||
* 在 `1.n+2` 版本中,这个指标就被从代码库中删除,也不会再有后门了.
|
||||
|
||||
如果你想要从 `1.12` 版本升级到 `1.13` ,但仍然需要依赖指标 `A` ,那么可以在命令行中增加 `--show-hidden-metrics=1.12` ,但是在升级到 `1.14`时就必须要删除这个指标的依赖,因为这个版本中这个指标已经被删除了。
|
||||
如果你想要从 `1.12` 版本升级到 `1.13` ,但仍然需要依赖指标 `A` ,你可以通过命令行设置隐藏指标 `--show-hidden-metrics=1.12` ,但是在升级到 `1.14`时就必须要删除这个指标的依赖,因为这个版本中这个指标已经被删除了。
|
||||
|
||||
<!--
|
||||
## Component metrics
|
||||
|
@ -188,13 +188,13 @@ For example, for GCE these metrics are called:
|
|||
|
||||
## 组件指标
|
||||
|
||||
### kube-controller-manager指标
|
||||
### kube-controller-manager 指标
|
||||
|
||||
控制器管理器指标提供了有关控制器管理器性能和运行状况的重要见解。这些指标包括常见的一些Go语言运行时的重要指标(比如go_routine的数量)和一些控制器的特定指标(比如etcd的请求时延),还有一些Cloudprovider(比如AWS,GCE,OpenStack)的API请求时延,用来评估集群的整体运行状况。
|
||||
控制器管理器指标提供了有关控制器管理器性能和运行状况的重要见解。这些指标包括常见的一些 Go 语言运行时的重要指标(比如 go_routine 的数量)和一些控制器的特定指标(比如 etcd 的请求时延),还有一些云供应商(比如 AWS、GCE、OpenStack)的 API 请求延迟,用来评估集群的整体运行状况。
|
||||
|
||||
从Kubernetes 1.7开始,详细的Cloudprovider指标便可用于GCE, AWS, Vsphere和OpenStack的存储操作,这些指标可用于监控持久卷运行时的健康状况。
|
||||
从 Kubernetes 1.7 开始,详细的云供应商指标便可用于 GCE、 AWS、Vsphere 和 OpenStack 的存储操作,这些指标可用于监控持久卷运行时的健康状况。
|
||||
|
||||
举例,GCE的这些指标是这些:
|
||||
举例,GCE 的这些指标是这些:
|
||||
|
||||
```
|
||||
cloudprovider_gce_api_request_duration_seconds { request = "instance_list"}
|
||||
|
@ -215,8 +215,8 @@ cloudprovider_gce_api_request_duration_seconds { request = "list_disk"}
|
|||
* Read about the [Kubernetes deprecation policy](https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior )
|
||||
-->
|
||||
|
||||
* 阅读[Prometheus指标相关的文本格式](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format)
|
||||
* 查看[Kubernetes稳定版指标](https://github.com/kubernetes/kubernetes/blob/master/test/instrumentation/testdata/stable-metrics-list.yaml)列表
|
||||
* 查看[Kubernetes指标弃用策略](https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior )
|
||||
* 了解有关 [Prometheus 指标相关的文本格式](https://github.com/prometheus/docs/blob/master/content/docs/instrumenting/exposition_formats.md#text-based-format)
|
||||
* 查看 [Kubernetes 稳定版指标](https://github.com/kubernetes/kubernetes/blob/master/test/instrumentation/testdata/stable-metrics-list.yaml)列表
|
||||
* 了解有关 [Kubernetes 指标弃用策略](https://kubernetes.io/docs/reference/using-api/deprecation-policy/#deprecating-a-feature-or-behavior )
|
||||
|
||||
{{% /capture %}}
|
||||
|
|
Loading…
Reference in New Issue