监控
KES 服务器提供一个 metrics
API 端点,以 Prometheus 公开格式 公开各种服务器指标。
Prometheus 配置
使用以下步骤开始使用 Prometheus 监控 KES。
-
生成 Prometheus 凭据
为 Prometheus 服务器创建凭据,用于对 KES 进行身份验证。
$ kes identity new --key client.key --cert client.crt prometheus Private key: client.key Certificate: client.crt Identity: 2169daa644eb18b41d85214a20f7272d449e85ef4f1bf3e2609fbe3fa7ca00cd
-
创建 KES 策略
在 KES 服务器上创建一个策略,允许 Prometheus 抓取指标。
policy: prometheus: allow: - /v1/metrics identities: - 2169daa644eb18b41d85214a20f7272d449e85ef4f1bf3e2609fbe3fa7ca00cd # Use the identity of your client.crt
修改配置文件后重新启动 KES 服务器。 -
创建 Prometheus 抓取配置
配置 Prometheus 在抓取 KES 指标时使用 TLS 客户端证书。
global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: KES scheme: https tls_config: cert_file: client.crt key_file: client.key # ca_file: public.crt # Optionally, specify the KES server CA certificate or the self-signed KES server certificate. metrics_path: /v1/metrics static_configs: - targets: ['localhost:7373'] # Specify KES endpoint.
KES 和 Prometheus 服务器启动后,Prometheus 应该会检测到并显示一个新的 KES 目标。
Grafana
为了获得图形化仪表板,您可以将 Prometheus 抓取的 KES 指标连接到 Grafana。
MinIO 提供 KES 的示例 Grafana 仪表板配置。请参见 Github 上的 JSON 文件。