「GRAFANA-AGENT」- 学习指南 | Static mode Kubernetes operator

# 10/19/2023 Grafana Agent v0.37; Stability: Beta;

引入 Static Mode Kubernetes Operator 是为了与 Prometheus Operator 兼容,该特性允许 Static Mode 支持来自 Prometheus Operator 的资源,例如 ServiceMonitors、PodMonitors、Probes 等等;

⇒ 我们还未具体使用该功能,我们猜测是为了让 Grafana Agent 能够处理 Prometheus 的资源,正如 Grafana Agent 宣称的其能够采集指标发送到 Prometheus 中,所以它像是 Prometheus Operator 的另外一种实现;

性质

1)Variant which manages agents running in Static mode. 简而言之,通过云原生 CR 的方式来操作 Gafana Agent 服务;

构建

—— 服务部署 | Operator Mode | on Kubernetes | with Helm | Installing and Upgrading

Installing Grafana Agent Operator with Helm | Grafana Agent documentation

grafana-agent-operator

helm repo add grafana https://grafana.github.io/helm-charts
helm pull grafana/grafana-agent-operator                                        # grafana-agent-operator-0.2.8.tgz, Grafana Agent 0.28.0

helm show values ./grafana-agent-operator-0.2.8.tgz > grafana-agent-operator-0.2.8.helm-values.yaml
vim grafana-agent-operator-0.2.8.helm-values.yaml
...(1)nameOverride: "grafana-agent"
...(2)fullnameOverride: "grafana-agent"
...(3)kubeletService.namespace: observing-client

helm install --namespace=observing-client --create-namespace                   \
     grafana-agent                                                             \
    ./grafana-agent-operator-0.2.8.tgz -f grafana-agent-operator-0.2.8.helm-values.yaml

应用

Prometheus Operator 兼容性:您需要能够使用 Prometheus Operator 项目中的 ServiceMonitors、PodMonitors、Probes 来收集 Prometheus 指标;

Kubernetes Events (OM)