Skip to main content

grafana-operator

  • grafana-operator
  • 参考
  • API
    • GrafanaDashboard
    • GrafanaDataSource
    • GrafanaNotificationChannel
    • Grafana
tip
apiVersion: integreatly.org/v1alpha1
kind: Grafana
metadata:
name: cluster
spec:
client:
preferService: true
deployment:
envFrom:
- secretRef:
name: cluster-grafana-env
config:
server:
root_url: https://grafana.example.com
log:
mode: console
level: info
log.frontend:
enabled: true
auth:
# default 10m
token_rotation_interval_minutes: 600
auth.anonymous:
enabled: false
analytics:
reporting_enabled: false
check_for_updates: false
ingress:
enabled: true
hostname: grafana.example.com
path: /
pathType: Prefix
service:
name: grafana-cluster
# 没有 selector 不会匹配任何 dashboard
dashboardLabelSelector:
- matchExpressions:
- { key: category, operator: In, values: [plugin] }
# empty match All, null match nothing
dashboardNamespaceSelector: {}
resources:
requests:
cpu: 100m
memory: 100Mi

FAQ

error getting folders, expected status 200 but got 401

如果使用了 envFrom,确保 secret 里包含 GF_SECURITY_ADMIN_PASSWORD, GF_SECURITY_ADMIN_USER,且

spec:
deployment:
# 是否创建 grafana-admin-credentials
skipCreateAdminAccount: true
envFrom:
- secretRef:
# 包含 GF_SECURITY_ADMIN_PASSWORD 和 GF_SECURITY_ADMIN_USER,且
name: grafana-env

默认添加 security admin 的方式

env:
- name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
key: GF_SECURITY_ADMIN_USER
name: grafana-admin-credentials
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: GF_SECURITY_ADMIN_PASSWORD
name: grafana-admin-credentials

cannot list resource "namespaces" in API group "" at the cluster scope

开启 dashboardNamespaceSelector 后,rabc 需要给权限 list namespace