首页 > 解决方案 > Grafana 仪表板不适用于 Ingress

问题描述

我已安装在 kube-prometheus-stack 下方,并在尝试使用其自己的 Ingress URL 访问 Grafana 仪表板时出错。我相信我在这里遗漏了一些愚蠢的东西,但找不到任何线索。我在这里和其他人也看过类似的帖子。

图表:kube-prometheus-stack-9.4.5 应用版本:0.38.1

当我导航到https://myorg.grafanatest.com URL 时,我被重定向到https://myorg.grafanatest.com/login并显示以下消息。

在此处输入图像描述

对 grafana/values.yaml 所做的更改:

grafana.ini:
  server:
  # The full public facing url you use in browser, used for redirects and emails
  root_url: https://myorg.grafanatest.com

进行上述更改后,用于安装 Prometheus-Grafana 运算符的 Helm 命令。

 helm install  pg kube-prometheus-stack/ -n monitoring

我在 Grafana pod 内的 grafana.ini 文件中看到以下设置。

[analytics]
check_for_updates = true
[grafana_net]
url = https://grafana.net
[log]
mode = console
[paths]
data = /var/lib/grafana/data
logs = /var/log/grafana
plugins = /var/lib/grafana/plugins
provisioning = /etc/grafana/provisioning
[server]
root_url = https://myorg.grafanatest.com/

标签: kubernetesprometheusgrafana

解决方案


您需要从父图表 values.yaml 进行编辑

  1. 从 kube-prometheus-stack 图表中获取默认 values.yaml,保存到文件
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add stable https://kubernetes-charts.storage.googleapis.com/
helm repo update

helm show values prometheus-community/kube-prometheus-stack > values.yaml

在 values.yaml 文件中,像这样编辑:

## Using default values from https://github.com/grafana/helm-charts/blob/main/charts/grafana/values.yaml
##
#### This below line is in 509 line
grafana:
  enabled: true
  namespaceOverride: ""

  ## Deploy default dashboards.
  ##
  defaultDashboardsEnabled: true

  adminPassword: prom-operator

  ingress:
    ## If true, Grafana Ingress will be created
    ##
    enabled: true

    ## Annotations for Grafana Ingress
    ##
    annotations: {}
      # kubernetes.io/ingress.class: nginx
      # kubernetes.io/tls-acme: "true"

    ## Labels to be added to the Ingress
    ##
    labels: {}

    ## Hostnames.
    ## Must be provided if Ingress is enable.
    ##
    # hosts:
    #   - grafana.domain.com
    hosts:
      - myorg.grafanatest.com

    ## Path for grafana ingress
    path: /
  • grafana.ingress.enabledtrue
  • grafana.ingress.hosts添加- myorg.grafanatest.com
  1. 应用它
helm -n monitoring install -f ./values.yaml kube-prometheus prometheus-community/kube-prometheus-stack

希望能帮到你


推荐阅读