首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Grafana正在使用基本URL : http://localhost:3000生成链接,而不是使用我的url

Grafana正在使用基本URL : http://localhost:3000生成链接,而不是使用我的url
EN

Stack Overflow用户
提问于 2020-07-08 20:59:55
回答 2查看 476关注 0票数 1

我使用Kubernetes部署了grafana 7,下面是我的部署:

代码语言:javascript
运行
复制
apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-core
  namespace: monitoring
  labels:
    app: grafana
    component: core
spec:
  selector:
    matchLabels:
      app: grafana

  replicas: 1
  template:
    metadata:
      labels:
        app: grafana
        component: core
    spec:
      initContainers:
      - name: init-chown-data
        image: grafana/grafana:7.0.3
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsUser: 0
        command: ["chown", "-R", "472:472", "/var/lib/grafana"]
        volumeMounts:
        - name: grafana-persistent-storage
          mountPath: /var/lib/grafana
      containers:
      - image: grafana/grafana:7.0.3
        name: grafana-core
        imagePullPolicy: IfNotPresent
        securityContext:
          runAsUser: 472
        # env:
        envFrom:
          - secretRef:
              name: grafana-env
        env:
          # The following env variables set up basic auth twith the default admin user and admin password.
          - name: GF_INSTALL_PLUGINS
            value: grafana-clock-panel,grafana-simple-json-datasource,camptocamp-prometheus-alertmanager-datasource
          - name: GF_AUTH_BASIC_ENABLED
            value: "true"
          - name: GF_SECURITY_ADMIN_USER
            valueFrom:
              secretKeyRef:
                name: grafana
                key: admin-username
          - name: GF_SECURITY_ADMIN_PASSWORD
            valueFrom:
              secretKeyRef:
                name: grafana
                key: admin-password
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "false"
        readinessProbe:
          httpGet:
            path: /login
            port: 3000
          initialDelaySeconds: 30
          timeoutSeconds: 1
        volumeMounts:
        - name: grafana-persistent-storage
          mountPath: /var/lib/grafana
        - name: grafana-datasources
          mountPath: /etc/grafana/provisioning/datasources
      volumes:
      - name: grafana-persistent-storage
        persistentVolumeClaim:
          claimName: grafana-storage
      - name: grafana-datasources
        configMap:
          name: grafana-datasources
      nodeSelector:
        kops.k8s.io/instancegroup: monitoring-nodes

它工作得很好,但每次生成URL时,都是使用基本url:http://localhost:3000,而不是使用https://grafana.company.com

我可以在哪里配置它?我找不到一个环境变量来处理它。

EN

Stack Overflow用户

发布于 2021-07-22 15:22:48

我发现它可以通过在grafana pod中使用env变量来完成。这是一个棘手的设置,误用GF_SERVER_ROOT_URL的url格式到没有引号的your.url,没有https://http://"your.url",甚至是末尾没有/"http://your.url"都可能会导致问题。

代码语言:javascript
运行
复制
grafana:
  env:
    GF_SERVER_ROOT_URL: "http://your.url/"
  notifiers:
    notifiers.yaml:
      notifiers:
      - name: telegram
        type: telegram
        uid: telegram
        is_default: true
        settings:
          bottoken: "yourbottoken"
          chatid: "-yourchatid"

然后在已配置的仪表板中使用uid:“telegram

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62795402

复制
相关文章

相似问题

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