我已安装在kube-prometheus-stack下方,尝试使用其自己的Ingress URL访问Grafana仪表板时出现错误。我相信我在这里错过了一些愚蠢的东西,但是找不到任何线索。我在这里和其他地方都看过similar post。
图表: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
做出上述更改后,Helm命令用于安装Prometheus-Grafana操作符。
helm install pg kube-prometheus-stack/ -n monitoring
我在Grafana容器内的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/
答案 0 :(得分:1)
您需要从父图表的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.enabled
至true
grafana.ingress.hosts
添加- myorg.grafanatest.com
helm -n monitoring install -f ./values.yaml kube-prometheus prometheus-community/kube-prometheus-stack
希望能为您提供帮助
答案 1 :(得分:0)
现在就在这里发布解决方案。遵循上面提到的gumelaragum的步骤来创建values.yaml,并在其中更新以下值,然后将values.yaml传递给头盔安装步骤。不知道为什么不启用serve_from_sub_path就无法工作,但是现在可以正常工作了。请注意,由于我已经在安装过程之外创建了Ingress路由,因此未启用Ingress部分。
helm show values prometheus-com/kube-prometheus-stack > custom-values.yaml
然后通过更改以下custom-values.yaml中的值进行安装。根据需要更改名称空间。
helm -n monitoring install -f ./custom-values.yaml pg prometheus-com/kube-prometheus-stack
grafana:
enabled: true
namespaceOverride: ""
# set pspUseAppArmor to false to fix Grafana pod Init errors
rbac:
pspUseAppArmor: false
grafana.ini:
server:
domain: mysb.grafanasite.com
#root_url: "%(protocol)s://%(domain)s/"
root_url: https://mysb.grafanasite.com/grafana/
serve_from_sub_path: true
## Deploy default dashboards.
##
defaultDashboardsEnabled: true
adminPassword: prom-operator
ingress:
## If true, Grafana Ingress will be created
##
enabled: false
## 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:
- mysb.grafanasite.com
## Path for grafana ingress
path: /grafana/
我看到相同的值反映在Grafana容器安装路径(/etc/grafana/grafana.ini)内的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]
domain = mysb.grafanasite.com
root_url = https://mysb.grafanasite.com/grafana/
serve_from_sub_path = true