This documentation is for a release that is no longer maintained
See documentation for the latest supported version.3.6.4.2. 监控 DevWorkspace Operator
您可以配置示例监控堆栈来处理 DevWorkspace Operator 公开的指标。
3.6.4.2.1. 使用 Prometheus 收集 DevWorkspace Operator 指标 复制链接链接已复制到粘贴板!
要使用 Prometheus 来收集、存储和查询 DevWorkspace Operator 的指标:
先决条件
-
devworkspace-controller-metrics服务在端口8443中公开指标。 -
devworkspace-webhookserver服务在端口9443上公开指标。默认情况下,服务在端口9443上公开指标。 -
Prometheus 2.26.0 或更高版本正在运行。Prometheus 控制台在端口
9090上运行,带有对应的。参阅 Prometheus 的第一个步骤。服务和路由
流程
创建一个
ClusterRoleBinding,将与 Prometheus 关联的ServiceAccount绑定到 devworkspace-controller-metrics-readerClusterRole。注意如果没有
ClusterRoleBinding,您无法访问 DevWorkspace 指标,因为访问受基于角色的访问控制(RBAC)保护。例 3.31. ClusterRole
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 例 3.32. ClusterRoleBinding
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 将 Prometheus 配置为从
devworkspace-controller-metricsService 公开的端口8443提取指标,并从devworkspace-webhookserver服务公开的端口9443中提取指标。
验证步骤
使用 Prometheus 控制台查看和查询指标:
-
查看
http:// <prometheus_url> /metrics 中的指标。 从
http:// <prometheus_url>/graph 查询指标。如需更多信息,请参阅 使用表达式浏览器。
-
查看
-
通过查看
http:// <prometheus-url> /targets 上的目标端点,验证所有目标是否已启动。