首页 > 解决方案 > Grafana 为 Prometheus 数据源抛出 HTTP Error Bad Gateway

问题描述

我在我的 k8s 集群上设置了 Grafana 和 Prometheus。两者都是使用https://github.com/helm/charts/tree/master/stable通过 helm 安装的。Grafana 和 Prometheus 都是通过我的 domian 地址通过 k8s nginx 入口设置的。当我尝试在 Grafana 中将 Prometheus 设置为数据源时,我得到HTTP Error Bad Gateway. 在 Grafana 页面的 chrome 控制台中,我看到:

http://grafana.domain.com/api/datasources/proxy/1/api/v1/query?query=1%2B1&time=1554043210.447

Grafana version: Grafana v6.0.0 (commit: 34a9a62)

Prometheus 的 Grafana 数据源设置: URL: https://prometheus.mydomain.com:9090

Access: Server(Default)

Auth: Basic & TLS Client Auth

可能有什么问题以及如何调试/修复它?

标签: kubernetesgrafanaprometheuskubernetes-helm

解决方案


在 prometheus 数据库的 Grafana 数据源设置中,添加 prometheus 服务 dns 和服务端口。像下面

<prometheus service name>. Namespace. Svc. Cluster. Local:9090

推荐阅读