我正在使用 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/