grafana-operator

by QuenchWorks

Helm chartv0.0.4App 5.25.0Apache-2.0Verified publisher

Grafana Operator: run Grafana instances and manage their dashboards, datasources, folders, alert rules, contact points and notification policies from Kubernetes custom resources, also against a Grafana it does not run. The thirteen CRDs ship with the chart and new Grafana instances default to the QuenchWorks Grafana image. Hardened by QuenchWorks: built from source, nonroot, CVE-gated, cosign-signed and pinned by digest.

About this chart

Quenchworks grafana-operator

The Grafana Operator 5.25.0 on the QuenchWorks image (built from source, nonroot, CVE-gated at build, pinned by digest, cosign-signed). It runs Grafana instances and manages their dashboards, datasources, folders, library panels, alert rule groups, contact points, notification policies and service accounts from Kubernetes resources. It can also manage a Grafana it does not run (spec.external on a Grafana resource).

The chart installs the 13 grafana.integreatly.org CRDs, the operator Deployment and upstream's RBAC from the release tag.

Install

helm install grafana-operator oci://ghcr.io/quenchworks/charts/grafana-operator -n grafana --create-namespace

Then a Grafana and a dashboard:

apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata: { name: main, labels: { dashboards: main } }
spec: {}
---
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata: { name: hello }
spec:
  instanceSelector: { matchLabels: { dashboards: main } }
  json: '{"title": "Hello", "panels": []}'

The admin login is in Secret main-admin-credentials (GF_SECURITY_ADMIN_USER, GF_SECURITY_ADMIN_PASSWORD).

Values

KeyDefaultNotes
grafanaImage.repository / .digestour grafana imageRELATED_IMAGE_GRAFANA: every Grafana without spec.version runs it
watchNamespaces[]WATCH_NAMESPACE; empty watches every namespace
logLevelinfo--zap-log-level
logFormatconsole--zap-encoder, json for log pipelines
extraArgs[]more operator flags, e.g. --max-concurrent-reconciles=4
replicaCount1above 1 turns on --leader-elect
rbac.createtrueupstream's ClusterRole plus a leader-election Role
networkPolicy.enabledtrueallows metrics (8080) and probes (8081)

Notes

  • Helm installs the CRDs on first install and never upgrades or deletes them. Apply the new crds/crds.yaml yourself before upgrading across operator releases.
  • A Grafana resource that sets spec.version to a tag runs docker.io/grafana/grafana:<tag>, not our image. Set it to an image reference with a digest (ghcr.io/quenchworks/images/grafana@sha256:...) to stay on hardened images.
  • The operator runs the Grafana pod as uid 10001 on a read-only root filesystem; our Grafana image works under that.

Deploy grafana-operator with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has grafana-operator on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartgrafana-operator is pinned at v0.0.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply