loki-stack
by Rishang
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
| Parameter | Description | Default |
|---|---|---|
loki.enabled | Enable Loki log aggregation | true |
loki.deploymentMode | Loki deployment mode | SingleBinary |
loki.singleBinary.persistence.enabled | Enable persistent storage for Loki | false |
rustfs.enabled | Enable optional RustFS S3-compatible object storage | false |
alloy.enabled | Enable Grafana Alloy log collector | true |
kube-prometheus-stack.enabled | Enable Prometheus and Grafana | true |
kube-prometheus-stack.grafana.enabled | Enable Grafana dashboard | true |
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:
- Loki (SingleBinary mode): Stores and indexes logs
- Grafana Alloy (DaemonSet): Collects logs from
/var/log/podson each node - Grafana: Provides UI for log exploration and visualization
- Prometheus: Collects metrics from Kubernetes and applications
- Alertmanager: Handles alerts from Prometheus
Log Collection
Grafana Alloy is configured to:
- Mount
/var/logfrom 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:
- Loki
- RustFS (optional, disabled by default via
rustfs.enabled: false) - Grafana Alloy
- kube-prometheus-stack
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.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartloki-stack is pinned at v1.0.3 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- 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