搜索

第 13 章 Red Hat Quay 下的 Prometheus 和 Grafana 指标

download PDF

Red Hat Quay 会为每个实例导出 Prometheus- 和 Grafana 兼容端点,以便轻松监控和警报。

13.1. 公开 Prometheus 端点

13.1.1. 独立 Red Hat Quay

使用 podman run 启动 Quay 容器时,公开指标端口 9091

$ sudo podman run -d --rm -p 80:8080 -p 443:8443  -p 9091:9091\
   --name=quay \
   -v $QUAY/config:/conf/stack:Z \
   -v $QUAY/storage:/datastorage:Z \
   registry.redhat.io/quay/quay-rhel8:v3.11.3

现在,指标可用:

$ curl quay.example.com:9091/metrics

有关配置 Prometheus 和 Grafana 以监控 Quay 存储库计数的详细信息,请参阅使用 Prometheus 和 Grafana 监控 Quay 和 Grafana。

13.1.2. Red Hat Quay Operator

确定 quay-metrics 服务的集群 IP:

$ oc get services -n quay-enterprise
NAME                                  TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                             AGE
example-registry-clair-app            ClusterIP   172.30.61.161    <none>        80/TCP,8089/TCP                     18h
example-registry-clair-postgres       ClusterIP   172.30.122.136   <none>        5432/TCP                            18h
example-registry-quay-app             ClusterIP   172.30.72.79     <none>        443/TCP,80/TCP,8081/TCP,55443/TCP   18h
example-registry-quay-config-editor   ClusterIP   172.30.185.61    <none>        80/TCP                              18h
example-registry-quay-database        ClusterIP   172.30.114.192   <none>        5432/TCP                            18h
example-registry-quay-metrics         ClusterIP   172.30.37.76     <none>        9091/TCP                            18h
example-registry-quay-redis           ClusterIP   172.30.157.248   <none>        6379/TCP                            18h

连接到集群,并使用 quay-metrics 服务的集群 IP 和端口访问指标:

$ oc debug node/master-0

sh-4.4# curl 172.30.37.76:9091/metrics

# HELP go_gc_duration_seconds A summary of the pause duration of garbage collection cycles.
# TYPE go_gc_duration_seconds summary
go_gc_duration_seconds{quantile="0"} 4.0447e-05
go_gc_duration_seconds{quantile="0.25"} 6.2203e-05
...

13.1.3. 将 Prometheus 设置为消耗指标

Prometheus 需要一种方式来访问集群中运行的所有 Red Hat Quay 实例。在典型的设置中,通过在一个命名 DNS 条目中列出所有 Red Hat Quay 实例来完成,然后提供给 Prometheus。

13.1.4. Kubernetes 下的 DNS 配置

可将简单的 Kubernetes 服务配置为 为 Prometheus 提供 DNS 条目。

13.1.5. 手动集群的 DNS 配置

SkyDNS 是不使用 Kubernetes 时管理此 DNS 记录的简单解决方案。SkyDNS 可以在 etcd 集群上运行。可以在 etcd 存储中添加并删除集群中的每个 Red Hat Quay 实例的条目。SkyDNS 定期从那里读取它们,并相应地更新 DNS 记录中的 Quay 实例列表。

Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.