Grafana:探测器因相对路径 Ingress 参数而失败

Grafana: probes fail with relative path Ingress parameters

上下文

假设我通过以下 ingress

暴露了 grafana
# Helm value file
grafana:
  ingress:
    enabled: true
    annotations: {}
    hosts:
      - host: chart-example.local
        paths: ["/grafana/"]

为了克服这个反向代理引发的相对路径问题,我使用了一个有用的机制,我用了好几次:grafana's docker image are entirely configurable with ENV VARS. Following this doc,然后我写了(不使用尚未变量):

kind: Deployment
.....
      containers:
        - name: {{ .Chart.Name }}-grafana
          image: "{{ .Values.grafana.image.repository }}:{{ .Values.grafana.image.tag | default .Chart.AppVersion }}"
          env:
          - name: GF_SERVER_ROOT_URL
            value: http://chart-example.local/grafana/
          ports:
            - name: http
              containerPort: 3000
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http

问题

现在就绪探测失败

Readiness probe failed: Get "/grafana/login": stopped after 10 redirects Back-off restarting failed container

我不太明白为什么。我试图更改 livenessProbereadinessProbe 的路径但没有太多的信心:从 pod 的角度来看,路径是相同的。例如,我可以使用此配置直接访问

http://${pods_ip}:3000/login

为什么会影响探测器

将以下内容添加到 grafana.ini configMap 解决了探测问题

[server]
serve_from_sub_path = true