From 6fa3b8a13f324bc0241edd051c6972b5c95f90ac Mon Sep 17 00:00:00 2001 From: Dalton Hubble Date: Sun, 17 Feb 2019 12:36:40 -0800 Subject: [PATCH] Upgrade Grafana to v6.0.0-beta2 and enable Explore UI * Upgrade Grafana from v5.4.3 to v6.0.0-beta2 * Enable Grafana Explore UI while still using only the Viewer role (inspect/edit without saving) * http://docs.grafana.org/guides/whats-new-in-v6-0/ --- CHANGES.md | 3 ++ addons/grafana/config.yaml | 36 +++++++++++++++++++ addons/grafana/datasources.yaml | 10 +++++- addons/grafana/deployment.yaml | 29 +++++++-------- ...ashboard-providers.yaml => providers.yaml} | 6 ++-- 5 files changed, 63 insertions(+), 21 deletions(-) create mode 100644 addons/grafana/config.yaml rename addons/grafana/{dashboard-providers.yaml => providers.yaml} (63%) diff --git a/CHANGES.md b/CHANGES.md index 7fb373a7..0b47c5a5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,9 @@ Notable changes between versions. * Improve Prometheus metrics labels and drop extraneous metrics ([#397](https://github.com/poseidon/typhoon/pull/397)) * Add `pod` name label to metrics discovered via service endpoints * Rename `kubernetes_namespace` label to `namespace` +* Revamp the Grafana addon ([#403](https://github.com/poseidon/typhoon/pull/403)) + * Upgrade Grafana from v5.4.3 to 6.0.0-beta2 + * Enable Grafana [Explore](http://docs.grafana.org/guides/whats-new-in-v6-0/#explore) UI as a Viewer (inspect/edit without saving) ## v1.13.3 diff --git a/addons/grafana/config.yaml b/addons/grafana/config.yaml new file mode 100644 index 00000000..c6c2421e --- /dev/null +++ b/addons/grafana/config.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-config + namespace: monitoring +data: + custom.ini: |+ + [server] + http_port = 8080 + + [paths] + data = /var/lib/grafana + plugins = /var/lib/grafana/plugins + provisioning = /etc/grafana/provisioning + + [users] + allow_sign_up = false + allow_org_create = false + # viewers can edit/inspect, but not save + viewers_can_edit = true + + # Disable login form, since Grafana always creates an admin user + [auth] + disable_login_form = true + + # Disable the user/pass login system + [auth.basic] + enabled = false + + # Allow anonymous authentication with view-only authorization + [auth.anonymous] + enabled = true + org_role = Viewer + + [analytics] + reporting_enabled = false diff --git a/addons/grafana/datasources.yaml b/addons/grafana/datasources.yaml index a13f52ef..d235ace5 100644 --- a/addons/grafana/datasources.yaml +++ b/addons/grafana/datasources.yaml @@ -10,7 +10,15 @@ data: - name: prometheus type: prometheus access: proxy - orgId: 1 url: http://prometheus.monitoring.svc.cluster.local version: 1 editable: false + loki.yaml: |+ + apiVersion: 1 + datasources: + - name: loki + type: loki + access: proxy + url: http://loki.monitoring.svc.cluster.local + version: 1 + editable: false diff --git a/addons/grafana/deployment.yaml b/addons/grafana/deployment.yaml index 409c4710..cfe9d608 100644 --- a/addons/grafana/deployment.yaml +++ b/addons/grafana/deployment.yaml @@ -23,20 +23,10 @@ spec: spec: containers: - name: grafana - image: grafana/grafana:5.4.3 + image: grafana/grafana:6.0.0-beta2 env: - - name: GF_SERVER_HTTP_PORT - value: "8080" - - name: GF_AUTH_BASIC_ENABLED - value: "false" - - name: GF_AUTH_DISABLE_LOGIN_FORM - value: "true" - - name: GF_AUTH_ANONYMOUS_ENABLED - value: "true" - - name: GF_AUTH_ANONYMOUS_ORG_ROLE - value: Viewer - - name: GF_ANALYTICS_REPORTING_ENABLED - value: "false" + - name: GF_PATHS_CONFIG + value: "/etc/grafana/custom.ini" ports: - name: http containerPort: 8080 @@ -48,19 +38,24 @@ spec: memory: 200Mi cpu: 200m volumeMounts: + - name: config + mountPath: /etc/grafana - name: datasources mountPath: /etc/grafana/provisioning/datasources - - name: dashboard-providers + - name: providers mountPath: /etc/grafana/provisioning/dashboards - name: dashboards - mountPath: /var/lib/grafana/dashboards + mountPath: /etc/grafana/dashboards volumes: + - name: config + configMap: + name: grafana-config - name: datasources configMap: name: grafana-datasources - - name: dashboard-providers + - name: providers configMap: - name: grafana-dashboard-providers + name: grafana-providers - name: dashboards configMap: name: grafana-dashboards diff --git a/addons/grafana/dashboard-providers.yaml b/addons/grafana/providers.yaml similarity index 63% rename from addons/grafana/dashboard-providers.yaml rename to addons/grafana/providers.yaml index e48924e8..3ddaf450 100644 --- a/addons/grafana/dashboard-providers.yaml +++ b/addons/grafana/providers.yaml @@ -1,10 +1,10 @@ apiVersion: v1 kind: ConfigMap metadata: - name: grafana-dashboard-providers + name: grafana-providers namespace: monitoring data: - dashboard-providers.yaml: |+ + providers.yaml: |+ apiVersion: 1 providers: - name: 'default' @@ -12,4 +12,4 @@ data: folder: '' type: file options: - path: /var/lib/grafana/dashboards + path: /etc/grafana/dashboards