首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >kube-prometheus-stack应用程序中的Grafana pod无法检测到数据源的configmap

kube-prometheus-stack应用程序中的Grafana pod无法检测到数据源的configmap
EN

Stack Overflow用户
提问于 2020-11-12 13:42:28
回答 1查看 846关注 0票数 1

我已经在一个牧场集群上安装了kube-prometheus-stack (https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack)的一个实例,并使用一个自定义的values.yaml来添加Grafana配置。

Values.yaml的Grafana部分:

代码语言:javascript
复制
grafana:
  enabled: true
  ingress:
    enabled: disabled
  service:
    type: ClusterIP
    port: 3000
    targetPort: 3000
    annotations: {}
    labels: {}
    portName: service
  sidecar:
    image:
      repository: kiwigrid/k8s-sidecar
      tag: 1.1.0
      sha: ""
    imagePullPolicy: IfNotPresent
    skipTlsVerify: true
    enableUniqueFilenames: false
    dashboards:
      enabled: true
      SCProvider: true
      label: grafana_dashboard
      folder: /tmp/dashboards
      defaultFolderName: null
      searchNamespace: ALL
      folderAnnotation: null
      provider:
        name: sidecarProvider
        orgid: 1
        folder: ''
        type: file
        disableDelete: false
        allowUiUpdates: true
        foldersFromFilesStructure: false
    datasources:
      enabled: true
      label: grafana_datasource
      searchNamespace: ALL

在安装之前,我还在Rancher中存储了一个名为grafana-datasource的配置映射,标签为: key:grafana_datasource,值为:1。此configmap存储在与kube-prometheus-stack应用程序相同的名称空间中。

在这个grafana-datasource配置映射中,我放入了以下数据:

代码语言:javascript
复制
apiVersion: 1
datasources:
- name: Test-Prometheus
  type: prometheus
  url: https://prometheus.test.net/
  access: proxy
  isDefault: false
  basicAuth: true
  basicAuthUser: admin
  basicAuthPassword: password
  withCredentials: false
  isDefault: false
  version: 1
  editable: true

我已经验证了我的数据源存在,并且能够登录到它并通过Grafana GUI手动添加它。但是,安装程序并没有获取我的grafana-datasource配置映射,并且只加载了默认的Grafana数据源:

如何在安装时启用grafana来拾取和应用自定义数据源配置映射?

EN

回答 1

Stack Overflow用户

发布于 2020-11-12 18:46:16

我复制了你的设置,一切都正常工作。

看起来您可能跳过了配置映射文件名的.yaml/.yml扩展名(因为您没有提到您使用了什么名称,这是最可能的原因)。像下面这样添加一个,它应该可以工作。

代码语言:javascript
复制
apiVersion: v1
data:
  custom.yaml: |
    apiVersion: 1
    datasources:
    - name: Test-Prometheus
      type: prometheus
      url: https://prometheus.test.net/
      access: proxy
      isDefault: false
      basicAuth: true
      basicAuthUser: admin
      basicAuthPassword: password
      withCredentials: false
      isDefault: false
      version: 1
      editable: true
kind: ConfigMap
metadata:
  creationTimestamp: null
  name: grafana-datasource
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64798504

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档