fix(content): refresh Docker and Kubernetes guidance

This commit is contained in:
yeasy
2026-05-20 09:16:36 -07:00
parent e91fe87822
commit 1b651e5f8c
10 changed files with 33 additions and 20 deletions
+3 -3
View File
@@ -160,10 +160,10 @@ $ docker compose up -d
* **节点 CPU 使用率**:`100 - (avg by (instance) (rate(node_cpu_seconds_total{mode="idle"}[5m])) * 100)`
* **节点内存使用率**:`(1 - (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes)) * 100`
* **节点磁盘空间使用率**:`(1 - (node_filesystem_avail_bytes{fstype!~"tmpfs|overlay"} / node_filesystem_size_bytes{fstype!~"tmpfs|overlay"})) * 100`
* **容器 CPU**:`sum by (name) (rate(container_cpu_usage_seconds_total[5m]))`
* **容器内存**:`sum by (name) (container_memory_working_set_bytes)`
* **容器 CPU**:`sum by (namespace, pod, container) (rate(container_cpu_usage_seconds_total[5m]))`
* **容器内存**:`sum by (namespace, pod, container) (container_memory_working_set_bytes)`
说明:不同版本的 cAdvisor/Docker 对 label 命名可能存在差异 (如 `name`、`container`、`container_name`),如果查询为空,建议先用 `label_values(container_cpu_usage_seconds_total, __name__)` 或在 Prometheus 的图形界面查看可用 label。
说明:不同采集路径的 label 命名不同。Docker Compose 中独立部署的 cAdvisor 常见容器标签是 `name`;Kubernetes kubelet 的 `/metrics/cadvisor` 中,`container_cpu_usage_seconds_total` 等稳定指标使用 `container`、`pod`、`namespace`。如果查询为空,先直接查询 `container_cpu_usage_seconds_total` 样本并在 Prometheus 图形界面查看实际 label,不要假设存在 `container_name`。
#### Targets down 排错清单