- Create a secret
- Add the secrets as environment variables to the Grafana section of the Prometheus yaml
- Use the environment values (secureJsonData)
Created
March 5, 2024 19:24
-
-
Save stand-sure/94787feb49df3c151be51127f4a623c7 to your computer and use it in GitHub Desktop.
Kube Stack Prometheus Grafana Datasource with Secrets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: clickhouse-datasources | |
namespace: monitoring | |
labels: | |
grafana_datasource: "1" | |
data: | |
clickhouse-datasources.yaml: |- | |
apiVersion: 1 | |
datasources: | |
- name: otel-clickhouse-datasource | |
type: grafana-clickhouse-datasource | |
typeName: ClickHouse | |
typeLogoUrl: "/public/plugins/grafana-clickhouse-datasource/img/logo.svg" | |
access: proxy | |
jsonData: | |
defaultDatabase: otel | |
defaultTable: otel_traces | |
host: clickhouse-service-name.observability.svc | |
logs: | |
defaultDatabase: otel | |
defaultTable: otel_logs | |
otelEnabled: true | |
otelVersion: latest | |
port: 9000 | |
protocol: native | |
tlsSkipVerify: false | |
traces: | |
defaultDatabase: otel | |
defaultTable: otel_traces | |
durationUnit: nanoseconds | |
otelEnabled: true | |
otelVersion: latest | |
username: "${CLICKHOUSE_USER}" | |
secureJsonData: | |
password: "${CLICKHOUSE_PASSWORD}" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: clickhouse-user-otel | |
namespace: observability | |
stringData: | |
username: "some user name" | |
password: "some password" | |
type: Opaque |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grafana: | |
plugins: | |
- grafana-clickhouse-datasource | |
- grafana-clock-panel | |
- redis-datasource | |
envValueFrom: | |
CLICKHOUSE_USER: | |
secretKeyRef: | |
name: clickhouse-user-otel | |
key: userName | |
CLICKHOUSE_PASSWORD: | |
secretKeyRef: | |
name: clickhouse-user-otel | |
key: password | |
prometheus: | |
prometheusSpec: | |
thanos: | |
objectStorageConfig: | |
existingSecret: | |
key: thanos.yaml | |
name: thanos-objectstore-config | |
thanosService: | |
enabled: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment