loki-stack

by Rishang

Helm chartv1.0.3App 1.0.3Verified publisher

Observability stack - Loki for logs, Grafana for visualization, Prometheus for metrics, and Grafana Alloy for log collection (alternative to deprecated Promtail) [DOCS => https://rishang.github.io/helm-charts/loki-stack/introduction]

About this chart

Loki Stack Helm Chart

Observability stack - Loki for logs, Grafana for visualization, Prometheus for metrics, and Grafana Alloy for log collection (alternative to deprecated Promtail).

DOCS: https://rishang.github.io/helm-charts/loki-stack/introduction

Overview

This Helm chart deploys a complete observability stack on Kubernetes, providing:

  • Loki: Log aggregation system for storing and querying logs
  • Grafana: Visualization and dashboards for logs and metrics
  • Prometheus: Metrics collection and monitoring via kube-prometheus-stack
  • Grafana Alloy: Modern log collection agent (replaces deprecated Promtail)
  • RustFS: Optional S3-compatible object storage for Loki logs (disabled by default)

Prerequisites

  • Kubernetes 1.22+
  • Helm 3.0+
  • Persistent storage (optional, but recommended for production)

Installation

Add the repository (if applicable)

helm repo add common-charts https://rishang.github.io/helm-charts/charts
helm repo update

Install the chart

helm install loki-stack common-charts/loki-stack --namespace monitoring --create-namespace

Install with custom values

helm install loki-stack . --namespace monitoring --create-namespace --values custom-values.yaml

Configuration

Key Configuration Options

ParameterDescriptionDefault
loki.enabledEnable Loki log aggregationtrue
loki.deploymentModeLoki deployment modeSingleBinary
loki.singleBinary.persistence.enabledEnable persistent storage for Lokifalse
rustfs.enabledEnable optional RustFS S3-compatible object storagefalse
alloy.enabledEnable Grafana Alloy log collectortrue
kube-prometheus-stack.enabledEnable Prometheus and Grafanatrue
kube-prometheus-stack.grafana.enabledEnable Grafana dashboardtrue

Example: Enable Persistence

loki:
  singleBinary:
    persistence:
      enabled: true
      size: 10Gi
      storageClass: standard

Example: Disable Components

# Disable Prometheus stack, keep only Loki and Alloy
kube-prometheus-stack:
  enabled: false

Example: Store Loki Logs in RustFS/S3

RustFS is disabled by default. To use it as Loki object storage, enable rustfs.enabled, create the Loki buckets in RustFS, and override Loki storage to S3. See the commented example in values.yaml.

Accessing Services

Grafana Dashboard

Port-forward to access Grafana:

kubectl port-forward -n monitoring svc/loki-stack-grafana 3000:80

Default credentials:

  • Username: admin
  • Password: Run kubectl get secret -n monitoring loki-stack-grafana -o jsonpath="{.data.admin-password}" | base64 --decode

Loki Query API

Port-forward to access Loki directly:

kubectl port-forward -n monitoring svc/loki-stack-loki 3100:3100

Query logs: http://localhost:3100/loki/api/v1/query

Architecture

This chart deploys:

  1. Loki (SingleBinary mode): Stores and indexes logs
  2. Grafana Alloy (DaemonSet): Collects logs from /var/log/pods on each node
  3. Grafana: Provides UI for log exploration and visualization
  4. Prometheus: Collects metrics from Kubernetes and applications
  5. Alertmanager: Handles alerts from Prometheus

Log Collection

Grafana Alloy is configured to:

  • Mount /var/log from each node
  • Discover and tail logs from /var/log/pods/*/*/*.log
  • Parse Kubernetes metadata (namespace, pod, container)
  • Forward logs to Loki with proper labels

Upgrading

helm upgrade loki-stack . --namespace monitoring --values custom-values.yaml

Uninstallation

helm uninstall loki-stack --namespace monitoring

Note: PersistentVolumeClaims are not automatically deleted. Remove them manually if needed:

kubectl delete pvc -n monitoring -l app.kubernetes.io/instance=loki-stack

Testing

Generate manifest for validation:

helm template loki-stack . --namespace monitoring --values test/values.yaml > loki-stack-manifest.yaml

Dependencies

This chart depends on:

Support

For issues and questions:

  • Chart Issues: GitHub Issues
  • Loki Documentation: https://grafana.com/docs/loki/
  • Alloy Documentation: https://grafana.com/docs/alloy/

Deploy loki-stack with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has loki-stack 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 chartloki-stack is pinned at v1.0.3 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