千家信息网

Thanos中怎么实现Prometheus指标联邦

发表于:2025-12-02 作者:千家信息网编辑
千家信息网最后更新 2025年12月02日,这篇文章将为大家详细讲解有关Thanos中怎么实现Prometheus指标联邦,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。安装Thanos我们将需要
千家信息网最后更新 2025年12月02日Thanos中怎么实现Prometheus指标联邦

这篇文章将为大家详细讲解有关Thanos中怎么实现Prometheus指标联邦,文章内容质量较高,因此小编分享给大家做个参考,希望大家阅读完这篇文章后对相关知识有一定的了解。

安装Thanos

我们将需要以下Thanos组件:

  • Thanos存储gateway

  • Thanos接收器(receiver)

  • Thanos查询器(querier)

  • 对象存储

该解决方案如下所示:

                 +Tenant's Premise | Provider Premise                 |                 |            +------------------------+                 |            |                        |                 |  +-------->+     Object Storage     |                 |  |         |                        |                 |  |         +-----------+------------+                 |  |                     ^                 |  | S3 API              | S3 API                 |  |                     |                 |  |         +-----------+------------+                 |  |         |                        |       Store API                 |  |         |  Thanos Store Gateway  +<-----------------------+                 |  |         |                        |                        |                 |  |         +------------------------+                        |                 |  |                                                           |                 |  +---------------------+                                     |                 |                        |                                     |+--------------+ |            +-----------+------------+              +---------+--------+|              | | Remote     |                        |  Store API   |                  ||  Prometheus  +------------->+     Thanos Receiver    +<-------------+  Thanos Querier  ||              | | Write      |                        |              |                  |+--------------+ |            +------------------------+              +---------+--------+                 |                                                              ^                 |                                                              |+--------------+ |                                                              ||              | |                PromQL                                        ||    User      +----------------------------------------------------------------+|              | |+--------------+ |                 +

来源:Thanos receive proposal

Thanos支持若干对象存储配置。我们将使用MinIO作为我们的对象存储。你需要在名为thanos-objectStorage的secret中定义对象存储,它需要在你的Thanos deployment命名空间中。

thanos-config.yaml如下所示:

type: s3config:  bucket: thanos  endpoint: ${minio-endpoint}  access_key: ${minio-access-key}  secret_key: ${minio-secret-key}  insecure: true

你可以按照以下方式创建secret:

kubectl create secret generic thanos-objectstorage --from-file=thanos.yaml="$PATH_TO_CONFIG"/thanos-config.yaml

配置Rancher监控

与Rancher监控operator打包的Prometheus版本已经支持remote_readremote_write集成。

Thanos receive endpoint的额外设置可以通过高级选项传递,如下所示:

我们需要按照Prometheus remote_write规范的要求,指定一个唯一的名字。

# The name will be used in metrics and logging in place of a generated value to help users distinguish between# remote write configs.[ name:  ]

你完成了监控的部署之后,你应该可以使用Thanos查询器查看你的指标。

已存储的指标也将在对象存储中获取。

由于所有的集群指标在这个Thanos安装中都是可用的,所以工作负载的所有者需要确保对工作负载和指标的访问是安全的。

关于Thanos中怎么实现Prometheus指标联邦就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

0