docs(design): 中心监控去 Operator 化 + 落点定案(backlog#2062) - #13
Conversation
依据 backlog#2062 的落地决策(完全原生、不用 Operator、3 个手写 chart)修订设计文档: - §3.1 / §4.7.1 / §4.7.2 / §4.8.1:kube-prometheus-stack → 3 个自研手写 Helm chart; 采集目标 ServiceMonitor → kubernetes_sd_configs(不依赖 CRD) - §4.7.2 新增「为什么 `replicas: 2` 不是 HA」:单 URL + 2 副本是分片, 两副本各持不完整数据 → 规则各自评估 → 告警不可信;一期定 replicas: 1, 二期换 VictoriaMetrics,并附二期组件去留表 - §4.8.1 新增「为什么不用 Operator」(CI 在 kind 上 ct install 无 CRD、用不上 声明式选目标、少一层升级面),补 tcpSocket 探针、web.config.file 轮换、 istio-injection: disabled 等易漏点;补 1 个 prometheus 自采 job 的有意偏差说明 - §4.7.4 / §4.8.2 / §4.9.1 / §4.9.2:istio gateway 按 host 区分(替代「复用 ELB、 端口分开」);Service 名改 community-*;Grafana 数据源补 basicAuth 与 裸 $VAR 的 provisioning 插值陷阱 - §6:R20 由「待验证」改为「已定论」;新增 R21(中心落点/共存未定 + AppProject sourceRepos 不在 Git 里) - 文档内 Open-Infra-Ops/helm-chart-value → opensourceways/helm-chart-value §3.1.1 存量系统图(L145-174)按原指示不动。 Co-Authored-By: Claude Code <noreply@anthropic.com>
U1 定案:中心落在 infra-cn4-x86-common-cluster,ns 新建 infra-monitoring-community,与 ascend 资源块的 infra-monitoring 同集群、不同 ns,两套完全独立。 - §4.8.1 位置段重写:说明「复用集群」相对原文「新申请独立集群」的有意改动, 并以对照表列出两套的数据域 / 组件 / 告警出口差异 - §4.8.1 补「明确不做 Pushgateway」:服务侧都是长驻进程、无 push 场景; 仅当纳入 CronJob 形态服务时才需要,届时须先解决多集群 label 归属 - §4.7.4 / §4.8.1 / §4.9.2 的 FQDN 与 ns 名同步 - §6:R21 结案(落点已定,保留容量配额这一剩余风险); 原 R21 后半段的 AppProject 白名单问题拆出为新的 R22(仍开放,硬阻断) Co-Authored-By: Claude Code <noreply@anthropic.com>
与运维确认:三个 Application 按现有配置即可正常拉取 helm-charts.git / helm-chart-value.git,不存在访问问题。 故不提交 project.yaml:该 AppProject 是带外创建的真实定义, 从 Git 覆盖它只会引入不一致,也消除了「漏写现有源会整体覆盖、 打断现存 9 个 App」这一风险。 Co-Authored-By: Claude Code <noreply@anthropic.com>
Welcome To opensourceways CommunityHey @TangJia025 , thanks for your contribution to the community. Bot Usage ManualI'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands. Contact GuideIf you have any questions, please contact the SIG: infratructure , |
CLA Signature PassTangJia025, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
Linking Issue Notice@TangJia025 , the pull request must be linked to at least one issue. |
在 infra-cn4-x86-common-cluster / ns infra-monitoring-community 实测踩到两点,
原文都没写对:
1. **指标口径**:中心是**纯接收端**、自己不发 remote_write,所以
prometheus_remote_storage_samples_total / _failed_total 这两个**发送侧**指标
在本地根本不存在,不能拿它们当观测依据,只能看 _in_total 一族。
2. **自采 job 必须带 basic_auth**:basic_auth_users 保护的是**整个 HTTP server**
(/metrics 与 /-/healthy 同样在内),不带凭据会拿 401、
up{job="prometheus"} 恒为 0,这些指标一条都进不了 TSDB。
失效形态是「静默为空」而非报错 —— 看起来一切正常,比误报更危险。
配套实现:opensourceways/helm-charts#310 + opensourceways/helm-chart-value#148。
Co-Authored-By: Claude Code <noreply@anthropic.com>
CLA Signature PassTangJia025, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
- §4.7.4:新增「两个 web 面合并成一个域名」——合并的理由(华为云 WAF 逐域名 配置,少一个域名少一份运维申请;istio 一个 host 只认一个 VirtualService, 两个 VS 声明同一 host 不会合并)、代价(公网可达性绑在一起;二期源 IP 白名单失去 host 级隔离)与分工(Prometheus 无需路由前缀,只有 Grafana 需要 serve_from_sub_path)。 - §4.8.1:chart 清单去掉 grafana 的 VirtualService 并说明原因;入口与安全 一节改写为合并域名的路由表,并补「域名要经 WAF 单独申请、证书是 *.osinfra.cn 泛域名故无额外成本」。 - §4.8.2:Agent 写入地址同步为 https://monitoring.osinfra.cn/api/v1/write。 - §4.9.1:Grafana 入口改为「不再自带 VS」+ 子路径环境变量两项,并写明 探针路径为何不用跟着改。
CLA Signature PassTangJia025, thanks for your pull request. All authors of the commits have signed the CLA. 👍 |
依据 backlog#2062「自建中心 Prometheus 集群」的落地决策修订设计文档。3 个 commit:
f322e66去 Operator 化 + HA 结论修正342cc0b落点改infra-monitoring-community28fc90bR22 结案配套实现:chart → opensourceways/helm-charts#309;values → opensourceways/helm-chart-value#146;Application → opensourceways/infra-community#367。
1. 去 Operator 化
§3.1 / §4.7.1 / §4.7.2 / §4.8.1:
kube-prometheus-stack→ 3 个自研手写 Helm chart;采集目标ServiceMonitor→kubernetes_sd_configs(不依赖 CRD)。§4.8.1 新增「为什么不用 Operator」小节:①chart 仓 CI 是
ct install在 kind 上真实安装、kind 无任何 CRD;②「声明式选目标」这个核心价值我们用不到;③少一层升级/兼容面。2.⚠️ HA 结论修正(本 PR 最重要的一处)
原文 §4.7.2 写「HA:
replicas: 2+ pod 反亲和」,§6 R20 也只把它当成「去重问题」。这个前提不成立。单台 Prometheus 是单机 TSDB —— PromQL 只在本进程内执行,两实例互不知晓。当 Agent 的
remote_write只有一个 URL 时,两个副本各自持有不完整数据,且不是干净的「各一半」:TCP 连接被 conntrack 钉在某个 pod、queue_config的 shards 又随积压动态扩缩 → 偏斜程度还随时间漂移。后果分两层,第二层更要害:
rate()/sum()偏离真值、absent()误报。而「一条规则覆盖全部集群」这个收益的根基正是它必须可信。一期定
replicas: 1;replicas: 2要真成立只能靠 Agent 双端点 fan-out(出网流量与磁盘各 ×2),本期不做。二期换 VictoriaMetrics(把接收端本身做成集群),并附二期组件去留表——沉没成本只有「中心 Prometheus 本体」这一个 chart,规则内容 / Alertmanager / Grafana / istio 鉴权组织 / 业务集群 Agent 全部复用。R20 由「待验证」改为**「已定论」**,并明确:两副本也不得加区分性
external_labels(会破坏group_by: [cluster, alertname])。3. 其他
infra-cn4-x86-common-cluster(相对原文「新申请独立集群」的有意改动),nsinfra-monitoring-community—— 与资源块的infra-monitoring同集群、不同 ns。附两套的对照表(数据域 / 组件 / 告警出口),并说明为什么独立 ns(消除两个 ArgoCD 共管 Namespace 的冲突、不碰对方的 Operator 与 CRD)。/metrics,无 push 场景。--web.config.file开了之后探针必须用tcpSocket(basic auth 包裹整个 HTTP server,而httpGet探针无法携带凭据,Option to disable security on Prometheus health endpoints, /-/healthy and /-/ready prometheus/prometheus#9166);infra-monitoring-community必须带istio-injection: disabled;web.config.file每个 HTTP 请求都重读 → 改 Vault 即刻生效、无需 reload。prometheus自采 job,因为接收端健康(prometheus_remote_storage_samples_total/_failed_total)全在它上面,是 R2/R3/R20 的唯一观测手段。${VAR}二次展开陷阱:${VAR}会被再展开一次,口令含$即被截断 → 静默 401,必须写裸$VAR。project.yaml。Open-Infra-Ops/helm-chart-value→opensourceways/helm-chart-value。kube-prometheus-stack→ 3 个手写 chart + istio HTTPS 入口。§3.1.1 那张存量系统图(L145-174)按原指示未动 —— 它有明确警告「描述的是已跑通的存量系统,不是本方案要建的东西」,改了反而失真。
4. 入口合并为单域名(
dc939c9)中心的两个 web 面合并成一个域名
monitoring.osinfra.cn,按子路径区分:/grafana/给人看大盘、/api/v1/write给 Agent 写。<id>.vip1.huaweicloudwaf.com,要么 A 记录直指 WAF VIP、响应带Server: CloudWAF),少一个域名就少一份运维申请——而 U4(DNS/WAF)正是当前唯一阻塞项;②istio 一个 host+gateway 只认一个 VirtualService,两个 VS 声明同一 host 不会合并、只会有一个生效,另一份的路由静默 404。代价:两个服务的公网可达性被绑在一起;二期做 Agent 源 IP 白名单时失去 host 级隔离,要退到 path 级AuthorizationPolicy。charts/grafana的 VirtualService 并说明原因(同一 host 必须由单个 chart 独占);入口与安全一节改写为合并域名的路由表,并补「域名要经 WAF 单独申请,证书是*.osinfra.cn泛域名(DigiCert RapidSSL,SAN 含*.osinfra.cn/osinfra.cn)故无额外成本」。https://monitoring.osinfra.cn/api/v1/write。SubPathRedirect对/api前缀明确豁免重定向、apiHealthHandler比对的又是原始路径,所以子路径模式下/api/health仍在根/api下;探针直连容器、不过网关。这一点若搞错,Pod 会直接进 CrashLoop。Prometheus 侧除
externalUrl一个字符串外未动:它公网只有/api/v1/write一个路径,不需要--web.route-prefix——加了反而会把自采 job 读的/metrics一起挪走,那是已验证跑通的链路。配套:chart → opensourceways/helm-charts#311;values → opensourceways/helm-chart-value#149。
Resolves https://github.com/opensourceways/backlog/issues/2062
🤖 Generated with Claude Code
AI 使用声明
当前 PR 是否有 AI 参与:
opensourceways/helm-chart-value)