Files
docker_practice/19_observability
yeasy 4f92b3aa70 fix(19.3): add security trade-off note for cAdvisor privileged: true
The cAdvisor compose examples in 19.3.3 use `privileged: true`, which
contradicts the minimum-privilege / cap_drop=all guidance in chapter 18.
Add an explicit trade-off note before the first cAdvisor snippet
explaining the inconsistency and pointing to 18.4 for capability-based
hardening alternatives (cap_add: [SYS_ADMIN] + device_cgroup_rules
instead of full privileged mode).

This addresses the Round 1 review finding about pedagogical conflict
between the monitoring and security chapters.
2026-05-20 00:18:37 -07:00
..
2026-04-29 05:21:02 +00:00
2026-04-29 05:21:02 +00:00

第十九章 容器监控与日志

在生产环境中,容器化应用部署完成后,实时掌握容器的运行状态以及应用日志非常重要。本章将以 Docker/Compose 的场景为主,介绍容器监控与日志管理的落地思路与最小实践闭环。

对于 Kubernetes 场景,可观测性链路与组件选择通常会有所不同 (例如使用 Prometheus Operator、日志采集 DaemonSet 等)。本章会在关键点给出迁移提示,但不会展开为完整的 Kubernetes 教程。

我们将重点探讨以下内容:

  • 容器监控:以 Prometheus 为主,讲解如何采集和展示容器性能指标。
  • 日志管理:以 ELK (Elasticsearch, Logstash, Kibana) 套件为例,介绍集中式日志收集平台。

为了让读者能够在生产环境中真正用起来,本章会补齐以下“最小闭环”:

  • 关键指标与日志的验证方法
  • 常见故障排查路径
  • 最小告警闭环 (Prometheus -> Alertmanager -> 接收端)
  • 日志容量治理的最小实践

本章内容