我正在尝试将新的仪表板添加到下面的头盔图表中
https://github.com/helm/charts/tree/master/stable/prometheus-operator
文档不是很清楚。
我已经在名称空间中添加了一个配置映射,如下所示-
apiVersion: v1
kind: ConfigMap
metadata:
name: sample-grafana-dashboard
namespace: monitoring
labels:
grafana_dashboard: "1"
data:
etcd-dashboard.json: |-
{JSON}
根据文档,应仅“选择”并添加此文件,但不能添加。 https://github.com/helm/charts/tree/master/stable/grafana#configuration
我的values.yaml中的sidecar选项看起来像-
grafana:
enabled: true
## Deploy default dashboards.
##
defaultDashboardsEnabled: true
adminPassword: password
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: []
## Path for grafana ingress
path: /
## TLS configuration for grafana Ingress
## Secret must be manually created in the namespace
##
tls: []
# - secretName: grafana-general-tls
# hosts:
# - grafana.example.com
#dashboardsConfigMaps:
#sidecarProvider: sample-grafana-dashboard
sidecar:
dashboards:
enabled: true
label: grafana_dashboard
我也尝试将其添加到value.yml
dashboardsConfigMaps:
- sample-grafana-dashboard
这不起作用。
像我本人一样,没有人有任何将自己的仪表板添加到此掌舵图中的经验。
答案 0 :(得分:2)
总结:
对于sidecar
,您只需要将一个选项设置为true
-grafana.sidecar.dashboards.enabled
helm install stable/prometheus-operator --name prometheus-operator --set grafana.sidecar.dashboards.enabled=true --namespace monitoring
wget https://raw.githubusercontent.com/percona/grafana-dashboards/master/dashboards/MongoDB_Overview.json
kubectl -n monitoring create cm grafana-mongodb-overview --from-file=MongoDB_Overview.json
grafana.sidecar.dashboards.label
到grafana_dashboard
,因此:kubectl -n monitoring label cm grafana-mongodb-overview grafana_dashboard=mongodb-overview
现在您应该在grafana中找到新添加的仪表板,此外,每个带有标签grafana_dashboard
的confimap都将作为仪表板进行处理。
仪表板是持久且安全的,存储在configmap中。
答案 1 :(得分:0)
如果不更改掌舵图中的设置。 grafana的默认用户/密码为: 用户:admin 密码:prom-operator
答案 2 :(得分:0)
您必须:
来自values.yml:
dashboardsConfigMaps:
application: application
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: application
orgId: 1
folder: "Application Metrics"
type: file
disableDeletion: true
editable: false
options:
path: /var/lib/grafana/dashboards/application
现在,应用程序配置映射应该在pod的此目录中创建文件,并且如前所述,Sidecar应该将它们加载到GUI中显示的Application Metrics文件夹中。
这可能会回答您所写的问题,但只要使用kustonmise的仪表板不是太大,就意味着您可以将json放在磁盘上,而无需在其他文件中包含json:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
# May choose to enable this if need to refer to configmaps outside of kustomize
generatorOptions:
disableNameSuffixHash: true
namespace: monitoring
configMapGenerator:
- name: application
files:
- grafana-dashboards/application/api01.json
- grafana-dashboards/application/api02.json
为了完整性起见,您也可以从url或Grafana网站加载仪表板,尽管我不相信在同一文件夹中使用混合方法。
所以:
dashboards:
kafka:
kafka01:
url: https://raw.githubusercontent.com/kudobuilder/operators/master/repository/kafka/docs/latest/resources/grafana-dashboard.json
folder: "KUDO Kafka"
datasource: Prometheus
nginx:
nginx1:
gnetId: 9614
datasource: Prometheus
dashboardProviders:
dashboardproviders.yaml:
apiVersion: 1
providers:
- name: kafka
orgId: 1
folder: "KUDO Kafka"
type: file
disableDeletion: true
editable: false
options:
path: /var/lib/grafana/dashboards/kafka
- name: nginx
orgId: 1
folder: Nginx
type: file
disableDeletion: true
editable: false
options:
path: /var/lib/grafana/dashboards/nginx
从外部来源创建两个新文件夹,每个文件夹都包含一个仪表板,或者您可以将其指向git存储库,从而将仪表板提交与部署脱钩。