Prometheus 的新战场:精准监控阿里云 AKS Serverless 集群
作者:IT资讯 来源:IT资讯 浏览: 【大中小】 发布时间:2025-11-27 00:02:29 评论数:
引言
我们紧接着上篇的战场 PromQL ,接着往上盖大楼 。精准监控集群这篇我们的阿里主角是 Prometheus-Operator 的 Prometheus,它的战场重要性就不言而喻了 。
Prometheus-Operator 是精准监控集群 Kubernetes 生态中广泛应用的监控组件,能够简化 Prometheus 的阿里部署和管理 。然而 ,战场随着云原生技术的精准监控集群发展 ,高防服务器监控阿里云 AKS Serverless 集群成为了一个新的阿里挑战。这些服务本质上是战场无服务器的,无法通过传统的精准监控集群节点指标采集方式进行监控。因此,阿里我们需要对 Prometheus 自身进行调整 ,战场以更好地适配阿里云 AKS Serverless 场景 。精准监控集群
本文将探讨如何通过重塑 Prometheus ,阿里使其高效监控阿里云 AKS Serverless 环境。
开始
基本设计
prometheus-operator 的控制链路其实非常简单 ,我们只需要知道以下基本原理就行 :
• PodMonitor 和 ServiceMonitor 最终是用于生成 Prometheus 配置文件中的香港云服务器 srape_config;
• Prometheus 可以使用一个 HTTP Post 请求 /-/reload 来在运行时重新加载配置文件使新的 scrape_config 生效;
以上文为例,prometheus-operator 的控制链路是 :
Prometheusprometheus-operator 监听 Promtheus 资源 ,当有 Add Event 发生时 ,prometheus-operator 将以 StatefulSet 的形式部署 Prometheus 实例 。每一个 Prometheus Pod 里有两个容器:
• prometheus 容器 :主容器 ,使用 /etc/prometheus/config_out/prometheus.env.yaml 作为主要的配置文件:
复制... - --config.file=/etc/prometheus/config_out/prometheus.env.yaml ...1.2.3.• prometheus-config-reloader 容器:辅助容器 ,用于监听上游配置文件的变化并调用主容器的 reload 接口重新加载配置;
当我们观察这个 Pod 的 volumes 时候,有两个 volume 可以重点关注 :
复制... volumes: - name: config secret: defaultMode: 420 secretName: prom-agent-prometheus-agent - name: config-out emptyDir: medium: Memory ...1.2.3.4.5.6.7.8.9.10.• config-out:EmptyDir 类型的亿华云卷,主要是用于 prometheus 容器与 prometheus-config-reloader 容器的数据共享 ,同时挂载于两个容器的 /etc/prometheus/config_out/ 中;
• config:底层是一个 Secret,这个 config 将被挂载为 prometheus-config-reloader 容器中的 /etc/prometheus/config/prometheus.yaml.gz
