You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Grafana Infinity数据源配置允许所有主机失败,求解决方法

Grafana Infinity数据源允许所有主机配置不生效的解决方法

我尝试为Grafana的Infinity数据源配置允许所有主机,对应的grafana-app-config-datasource ConfigMap配置如下:

kubectl describe configmap grafana-app-config-datasource -n grafana
Name:         grafana-app-config-datasource
Namespace:    grafana
Labels:       <none>
Annotations:  <none>

Data
====
influxdb-datasource.yml:
----
# config file version
apiVersion: 1

datasources:
  - name: infuxdb
    type: "influxdb"
    access: "proxy"
    url: "http://influxdb2-abcd-service:8085"
    editable: true
    secureJsonData:
      token: "7hgdfhgfhghghghMMJkbkylrGlwfXTS"
    jsonData:
      version: Flux
      organization: "fgfgfg450"
      defaultBucket: xyz-bucket
      tlsSkipVerify: true
      timeInterval: "1m"
  - uid: "Z_L7ZejIz"
    orgId: 1
    name: "Infinity"
    type: "yesoreyeram-infinity-datasource"
    url: ""
    basicAuth: false
    basicAuthUser: ""
    isDefault: false
    jsonData:
      auth_method: "bearerToken"
      global_queries: []
      allowedHosts: "*"
      oauthPassThru: false
    version: 2
    readOnly: false
    secureJsonData:
      bearerToken: "hhjy-hfjfhfghhfgid6ZzDXlhjhfjhfjhfjhfjfhjwrw"

Events:  <none>

设置allowedHosts: "*"后配置不生效,收到错误提示:

datasource is missing allowed host/URLs, Configure it in datasource settings page for enhanced security

解决方法

Infinity数据源的allowedHosts配置要求为数组类型,而非字符串类型。当前配置的字符串格式不符合要求,需修改为数组:

修改后的Infinity数据源配置片段

- uid: "Z_L7ZejIz"
  orgId: 1
  name: "Infinity"
  type: "yesoreyeram-infinity-datasource"
  url: ""
  basicAuth: false
  basicAuthUser: ""
  isDefault: false
  jsonData:
    auth_method: "bearerToken"
    global_queries: []
    allowedHosts: ["*"]  # 改为数组格式
    oauthPassThru: false
  version: 2
  readOnly: false
  secureJsonData:
    bearerToken: "hhjy-hfjfhfghhfgid6ZzDXlhjhfjhfjhfjhfjfhjwrw"

生效配置步骤

  1. 更新ConfigMap:

    kubectl edit configmap grafana-app-config-datasource -n grafana
    

    将allowedHosts: "*"替换为allowedHosts: ["*"]后保存退出。

  2. 重启Grafana Pod使配置生效:

    kubectl rollout restart deployment/grafana -n grafana
    

内容的提问来源于stack exchange,提问作者M.K.S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 16:31:11