Skip to content
nebari-devPublic

About

Cluster observability with the Grafana LGTM stack: Loki logs, Tempo traces, Mimir metrics, and Grafana dashboards.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

nebari-lgtm-pack

A Helm chart for deploying the Grafana LGTM observability stack on Kubernetes with optional Nebari platform integration.

Components

Component Purpose Default Mode
Grafana Dashboards & visualization Single replica
Loki Log aggregation SingleBinary
Tempo Distributed tracing Single replica
Mimir Metrics (Prometheus-compatible) Monolithic (single-binary)

Architecture

┌─────────────────────────────────────────────────────────┐
│                       Grafana UI                        │
│                  (port 3000 / svc :80)                  │
│                                                         │
│  Datasources:                                           │
│    ├── Loki   → http://lgtm-pack-loki:3100              │
│    ├── Tempo  → http://lgtm-pack-tempo:3200             │
│    └── Mimir  → http://lgtm-pack-mimir:8080/prometheus  │
└─────────────────────────────────────────────────────────┘

Push endpoints (for external ingest):
  ├── Loki   :3100  /loki/api/v1/push
  ├── Tempo  :4317  (gRPC) / :4318 (HTTP)
  └── Mimir  :8080  /api/v1/push (Prometheus remote-write)

Quick Start

Prerequisites

  • Kubernetes cluster (or k3d for local dev)
  • Helm v3+

Install

The chart source lives in chart/. From a clone:

helm dependency update chart
helm install lgtm-pack chart --namespace default --set nebariapp.enabled=false

Or from the published Nebari Helm repository (this chart is released via nebari-dev/helm-repository):

helm repo add nebari https://raw.githubusercontent.com/nebari-dev/helm-repository/gh-pages/
helm repo update nebari
helm install lgtm-pack nebari/nebari-lgtm-pack --namespace default --set nebariapp.enabled=false

Grafana will be available at port 80 of the lgtm-pack-grafana service (default credentials: admin/admin).

Deploy as an ArgoCD Application

On a GitOps-managed Nebari cluster, deploy the pack by applying an ArgoCD Application that sources the chart from the Nebari Helm repository. Two complete, ready-to-edit manifests live at examples/argocd-application.yaml — one for the default monolithic Mimir and one for the opt-in distributed mode. Copy the one you want into its own file (they are alternatives for the same release; applying the whole file would deploy only the last document) and apply it:

kubectl apply -f my-lgtm-application.yaml

Set nebariapp.hostname and nebariapp.keycloakHostname to your cluster's values before applying. The example pins targetRevision to a published chart version and opts the monitoring namespace into Nebari management (nebari.dev/managed: "true") so the nebari-operator reconciles the bundled NebariApp.

Local Development

Prerequisites: Docker, ctlptl, Tilt

make up       # Create k3d cluster + start Tilt dev loop
              # UI: http://localhost:10350
              # Grafana: http://localhost:3000
make down     # Tear down Tilt + delete k3d cluster

Configuration

All values under subchart keys pass through to the upstream charts:

Key Chart Docs
grafana.* grafana values
loki.* loki values
tempo.* tempo values
mimir.* (this chart) Monolithic Mimir — see chart/values.yaml
mimir-distributed.* mimir-distributed values

Mimir deployment modes

Mimir runs monolithic by default: a single-binary StatefulSet (-target=all) with filesystem storage on one PVC and compactor retention bounded at 30 days (mimir.retention). This is the only topology where Mimir's filesystem storage backend is valid.

For horizontal scale, switch to the distributed topology:

helm install lgtm-pack chart --set mimir-distributed.enabled=true --set nebariapp.enabled=false

Distributed mode deploys the upstream mimir-distributed subchart backed by a shared object store — bundled MinIO by default (dev-grade credentials; override for production), or a real cloud bucket (see the commented example under mimir-distributed in chart/values.yaml). Filesystem storage is never used in distributed mode: with per-component PVCs the compactor and store-gateway can't see the ingester's blocks, retention never runs, and the ingester disk fills until ingestion halts (issue #22).

The Grafana datasource and OTel collector endpoints follow the mode automatically.

Nebari Integration

Set nebariapp.enabled=true and provide nebariapp.hostname to create a NebariApp CRD for routing and Keycloak OAuth integration. See values.yaml for full options.

OpenTelemetry collector wiring

When this chart is installed on a cluster deployed by nebari-infrastructure-core (NIC), logs/traces/metrics are automatically routed to this chart's Loki/Tempo/Mimir backends. No manual edits to the GitOps repo are required.

How it works

  1. NIC's OTel collector is configured to mount an optional opentelemetry-collector-overrides ConfigMap and pass it to the collector as an additional --config file. An init container resolves the override file (or falls back to an empty {} if no software pack has provided one).
  2. This chart renders the opentelemetry-collector-overrides ConfigMap with our exporter and pipeline overrides — endpoints templated with {{ .Release.Name }} so custom release names work.
  3. The OTel collector deep-merges its base config (NIC's defaults) with this override at startup. Our pipeline overrides replace the [debug] exporter lists with [otlphttp/loki], [otlp/tempo], and [otlphttp/mimir] and set nothing else, so NIC's receivers and processors (including k8sattributes) are kept. The merge replaces lists rather than appending, so restating either list here would drop NIC's entries.
  4. A small post-install/post-upgrade Job rolls NIC's collector DaemonSet so the init container re-resolves the override file. The DaemonSet's checksum/config annotation is derived from Helm values, not from this external ConfigMap, so without an explicit rollout the new config would not be picked up until an unrelated pod restart.

Because NIC and this chart write to separate ConfigMaps, ArgoCD never has to choose between conflicting desired states — sidestepping upstream issue argo-cd#7478 where ignoreDifferences is bypassed during sync.

Disabling

Set otelCollectorOverrides.enabled=false if NIC is not managing the collector (e.g. standalone LGTM against a user-managed collector). Without the override ConfigMap, NIC's collector runs with debug exporters only.

Uninstall behavior

helm uninstall removes the opentelemetry-collector-overrides ConfigMap. NIC's collector pods continue using the previously-resolved override until they restart for any reason; at that point the init container falls back to empty {} and the collector reverts to debug exporters. To force the revert immediately:

kubectl -n monitoring rollout restart daemonset opentelemetry-collector-agent

Contributing dashboards from other software packs

Any Nebari software pack can ship a Grafana dashboard that is auto-provisioned alongside this pack's — the dashboard analog of the OpenTelemetry collector override above. No edits to this chart are required.

How it works

Grafana's dashboard sidecar runs with grafana.sidecar.dashboards.searchNamespace=ALL (the default in this chart). It watches every namespace for ConfigMaps (or Secrets) labeled grafana_dashboard and live-loads the JSON they contain into Grafana within ~30s — no Grafana restart. The grafana subchart grants the sidecar cluster-wide ConfigMap list/watch via a ClusterRole when searchNamespace=ALL.

Contract

Your pack renders a ConfigMap, in its own namespace, that looks like this:

apiVersion: v1
kind: ConfigMap
metadata:
  name: my-pack-dashboards
  namespace: my-pack            # your pack's namespace, not monitoring
  labels:
    grafana_dashboard: "1"      # discovery key the sidecar matches on
  annotations:
    grafana_folder: "My Pack"   # optional: groups the dashboard into a folder
data:
  my-dashboard.json: |          # key must end in .json
    { ...grafana dashboard model... }

In a Helm chart, render every JSON file under a dashboards/ directory so adding a dashboard is just dropping in a file:

# templates/grafana-dashboard.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ include "my-pack.fullname" . }}-dashboards
  namespace: {{ .Release.Namespace }}
  labels:
    grafana_dashboard: "1"
  annotations:
    grafana_folder: "My Pack"
data:
{{- range $path, $bytes := .Files.Glob "dashboards/*.json" }}
  {{ base $path }}: |-
{{ $.Files.Get $path | indent 4 }}
{{- end }}

Point panels at the existing datasources

The sidecar only loads dashboards; it does not create datasources. Reference the datasources this pack already provisions, by uid:

"datasource": { "type": "prometheus", "uid": "mimir" }

Available uids: mimir (metrics), loki (logs), tempo (traces). A panel pointing at a uid that does not exist renders empty.

Soft dependency

This is a soft dependency on the LGTM pack: if this pack (and therefore Grafana) is not installed, the contributing pack's ConfigMap simply sits unused — no error, no coupling — exactly like the OTel override ConfigMap when no collector is present.

Restricting discovery

To stop watching other namespaces, set grafana.sidecar.dashboards.searchNamespace to the release namespace (or a comma-separated list). Only this pack's own dashboards are then provisioned.

Documentation

The docs site lives in docs/ and is built with Astro + Starlight using the shared @nebari/starlight theme. It deploys to packs.nebari.dev/lgtm-pack/ on every merge to main; pull requests that touch docs/ get a preview URL posted as a comment.

make docs           # dev server with hot reload at http://localhost:4321
make docs-build     # static build into docs/dist/
make docs-preview   # serve the production build locally
make docs-test      # unit tests
make docs-check-links

Pages live in docs/src/content/docs/ — each .md or .mdx file becomes a page, and the sidebar is configured in docs/astro.config.mjs. See docs/README.md for details.

License

Apache 2.0 — see LICENSE.

About

Cluster observability with the Grafana LGTM stack: Loki logs, Tempo traces, Mimir metrics, and Grafana dashboards.

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages