首页 文章

Grafana HTTP错误错误网关和模板初始化失败错误

提问于
浏览
1

minikube 本地使用 helm PrometheusGrafana .

$ helm install stable/prometheus
$ helm install stable/grafana

Prometheus服务器,alertmanager grafana可以在设置端口转发后运行:

$ export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=server" -o jsonpath="{.items[0].metadata.name}")
$ kubectl --namespace default port-forward $POD_NAME 9090

$ export POD_NAME=$(kubectl get pods --namespace default -l "app=prometheus,component=alertmanager" -o jsonpath="{.items[0].metadata.name}")
$ kubectl --namespace default port-forward $POD_NAME 9093

$ export POD_NAME=$(kubectl get pods --namespace default -l "app=excited-crocodile-grafana,component=grafana" -o jsonpath="{.items[0].metadata.name}")
$ kubectl --namespace default port-forward $POD_NAME 3000

enter image description here

enter image description here

从grafana添加数据源,得到 HTTP Error Bad Gateway 错误:

enter image description here

从以下位置导入仪表板315:

https://grafana.com/dashboards/315

然后检查 Kubernetes cluster monitoring (via Prometheus) ,得到 Templating init failed 错误:

enter image description here

为什么?

1 回答

  • 2

    在Grafana的HTTP设置中,您将 Access 设置为 Proxy ,这意味着Grafana想要访问Prometheus . 由于Kubernetes使用覆盖网络,因此它是一个不同的IP .

    有两种方法可以解决这个问题:

    • Access 设置为 Direct ,以便浏览器直接连接到Prometheus .

    • 使用Kubernetes内部IP或域名 . 我不知道普罗米修斯头盔图,但假设有 Service 名为 prometheus ,像 http://prometheus:9090 这样的东西应该可行 .

相关问题