通过值配置仪表板

时间:2019-01-13 10:49:11

标签: kubernetes grafana helmfile

正如标题所示,我正在尝试使用helmfile和通过值的默认仪表板设置grafana。

我的头盔文件的相关部分在这里

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
      - dashboardProviders:
          dashboardproviders.yaml:
            apiVersion: 1
            providers:
            - name: 'default'
              orgId: 1
              folder: ''
              type: file
              disableDeletion: false
              editable: true
              options:
                path: /var/lib/grafana/dashboards
      - dashboards:
            default:
              k8s:
                url: https://grafana.com/api/dashboards/8588/revisions/1/download

据我阅读here的了解,我需要一个提供程序,然后可以通过url引用一个仪表板。但是,当我如上所述执行操作时,没有安装仪表板,而当我进行以下操作时(即)

      - dashboards:
          default:
            url: https://grafana.com/api/dashboards/8588/revisions/1/download

我收到以下错误消息

Error: render error in "grafana/templates/deployment.yaml": template: grafana/templates/deployment.yaml:148:20: executing "grafana/templates/deployment.yaml" at <$value>: wrong type for value; expected map[string]interface {}; got string

关于我在做什么错的任何线索吗?

1 个答案:

答案 0 :(得分:1)

我认为问题在于您将数据源,dashboardProviders和仪表板定义为列表而不是映射,因此您需要删除连字符,这意味着值部分变为:

values:
  datasources:
    datasources.yaml:
      apiVersion: 1
      datasources:
      - name: Prometheus
        type: prometheus
        url: http://prometheus-prometheus-server
        access: proxy
        isDefault: true
  dashboardProviders:
    dashboardproviders.yaml:
      apiVersion: 1
      providers:
      - name: 'default'
        orgId: 1
        folder: ''
        type: file
        disableDeletion: false
        editable: true
        options:
          path: /var/lib/grafana/dashboards
  dashboards:
    default:
      k8s:
        url: https://grafana.com/api/dashboards/8588/revisions/1/download

格拉法纳图表has them as mapsusing helmfile doesn't change that