如何从postgresql获取普罗米修斯指标?
我已经在Kubernetes v1.17 KOPS集群中安装了prometheus,确保设置了如何从postgresql获取普罗米修斯指标?,postgresql,kubernetes,prometheus,prometheus-operator,Postgresql,Kubernetes,Prometheus,Prometheus Operator,我已经在Kubernetes v1.17 KOPS集群中安装了prometheus,确保设置了--身份验证令牌webhook=true和--授权模式=webhook,并指定了配置 然后,我使用随以下套件提供的安装了Postgres: metrics: enabled: true # resources: {} service: type: ClusterIP annotations: prometheus.io/scrape: "true" p
--身份验证令牌webhook=true
和--授权模式=webhook
,并指定了配置
然后,我使用随以下套件提供的安装了Postgres:
metrics:
enabled: true
# resources: {}
service:
type: ClusterIP
annotations:
prometheus.io/scrape: "true"
prometheus.io/port: "9187"
loadBalancerIP:
serviceMonitor:
enabled: true
namespace: monitoring
interval: 30s
scrapeTimeout: 10s
这两项服务都已投入使用,但普罗米修斯没有从Postgres中发现任何指标。我的postgres pod上的
metrics
容器上的日志没有错误,monitoring
命名空间中的任何pod也没有错误。要让Postgres metrics exporter到达普罗米修斯,还需要哪些额外的步骤?尝试更新普罗米修斯的ClusterRole。默认情况下,它没有从非监视命名空间检索POD、服务和端点列表的权限 在我的系统中,最初的ClusterRole是:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus-k8s
rules:
- apiGroups:
- ""
resources:
- nodes/metrics
verbs:
- get
- nonResourceURLs:
- /metrics
verbs:
- get
我已将其更改为:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: prometheus-k8s
rules:
- apiGroups:
- ""
resources:
- nodes/metrics
- services
- endpoints
- pods
verbs:
- get
- list
- watch
- nonResourceURLs:
- /metrics
verbs:
- get
在这些改变之后,普罗米修斯将获得Postgres指标