如标题所示,我正在尝试使用helmfile和通过值的数据源设置grafana。
我可以在这里找到文档,但遗憾的是我的知识太有限,无法正常工作。
我的头盔文件的相关部分在这里
releases:
...
- name: grafana
namespace: grafana
chart: stable/grafana
values:
- datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.prometheus.svc.cluster.local
我偶然发现了这一点,似乎我也可以通过环境变量来做到这一点,但似乎找不到在helmfile中设置此类的简单方法。
如果对helmfile,json和其他方面有更好理解的人能够向我展示或指导我正确的方向,将不胜感激。
更新:感谢@WindyFields,我的最终解决方案如下
releases:
...
- name: grafana
namespace: grafana
chart: stable/grafana
values:
- datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus-server.prometheus.svc.cluster.local
isDefault: true
回答
只需将以下片段直接添加到values.yaml
:
datasources:
datasources.yaml:
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.prometheus.svc.cluster.local
细节
在Helm渲染模板之后,将生成以下configmap:
# Source: grafana/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: RELEASE-NAME-grafana
labels:
app: grafana
chart: grafana-1.20.0
release: RELEASE-NAME
heritage: Tiller
data:
grafana.ini: |
...
datasources.yaml: |
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
url: http://prometheus-server.prometheus.svc.cluster.local
赫尔姆斯安装图表后,K8S将数据源的配置datatsources.yaml
从config.yaml
和通过以下路径安装它/etc/grafana/provisioning/datasources/datasources.yaml
,在那里它将被Grafana应用拾取。
请参阅Grafana数据源供应文档。
提示:查看渲染的Helm模板的用法helm template <path_to_chart>
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句