kubernetes - 使用 Helm 时如何自动将 Grafana(使用 PostgreSQL 而不是 SQLite 3)连接到 Prometheus

标签 kubernetes grafana prometheus kubernetes-helm

我正在使用 Helm 作为 Kubernetes 部署(Grafana 和 Prometheus)。我已经为它们指定了 values.yaml 文件。效果惊人。

由于我已将 Grafana 数据源从默认的 sqlite3 更改为 PostgreSQL - 数据源配置现在存储在 PostgreSQL 数据库.

好吧,问题是在我的 **Grafana 的 values.yaml 文件* 中,我指定了如下数据源:

datasources: {}
datasources.yaml:
  apiVersion: 1
  datasources:
  - name: on-premis
    type: prometheus
    url: http://prom-helmf-ns-monitoring-prometheus-server
    access: direct
    isDefault: true
...
...


grafana.ini:
  paths:
    data: /var/lib/grafana/data
    logs: /var/log/grafana
    plugins: /var/lib/grafana/plugins
  analytics:
    check_for_updates: true
  log:
    mode: console
  grafana_net:
    url: https://grafana.net
  database:
  ## You can configure the database connection by specifying type, host, name, user and password
  ## # as separate properties or as on string using the URL property.
  ## # Either "mysql", "postgres" or "sqlite3", it's your choice
    type: postgres
    host: qa.com:5432
    name: grafana
    user: grafana
    # If the password contains # or ; you have to wrap it with trippel quotes. Ex """#password;"""
    password: passwd
    ssl_mode: disable

不幸的是,这没有效果,我必须在 Grafana 网络界面 中手动配置连接——这不是我需要的。如何正确指定此部分?

datasources: {}
datasources.yaml:
  apiVersion: 1
  datasources:
  - name: on-premis
    type: prometheus
    url: http://prom-helmf-ns-monitoring-prometheus-server
    access: direct
    isDefault: true

最佳答案

删除节数据源后的“{}”。 像这样

    datasources:
      datasources.yaml:
        apiVersion: 1
        datasources:
        - name: Prometheus
          type: prometheus
          url: http://prometheus-server
          access: proxy
          isDefault: true

关于kubernetes - 使用 Helm 时如何自动将 Grafana(使用 PostgreSQL 而不是 SQLite 3)连接到 Prometheus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50103467/

相关文章:

docker - 在 Openshift 上保护基于路径的路由

docker - 登录尝试 Nexus OSS Docker 存储库抛出 404

mysql - 如何使用 grafana 和 MySQL 添加时间序列查询?

prometheus - 如何将客户端应用程序事件导入普罗米修斯

azure - windows 导出器不从其他命名空间收集指标

kubernetes - 如何使用 skaffold 只重启一项服务?

linux - helm 升级代理参数

java - activemq 的监控和警报

grafana - 将 PM2 集群统计信息导出到 Prometheus

amazon-web-services - 如何使用 helm chart 在 VMWare 的 Kubernetes FluentD Operator 中将 prometheus.enabled 标志设置为 true?