Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/daviaraujocc/lgtm-stack

Step-by-step to install LGTM stack (Loki, Grafana, Tempo, Mimir)
https://github.com/daviaraujocc/lgtm-stack

grafana lgtm loki metrics mimir observability prometheus tempo

Last synced: about 11 hours ago
JSON representation

Step-by-step to install LGTM stack (Loki, Grafana, Tempo, Mimir)

Awesome Lists containing this project

README

        

# 🔍 LGTM Stack for Kubernetes

A complete observability platform deployment guide for Kubernetes. The LGTM stack combines best-in-class open-source tools to provide comprehensive system visibility:

- **Loki**: Log storage and management
- **Tempo**: Distributed tracing storage and management
- **Mimir**: Long-term metrics storage
- **Grafana**: Interface & Dashboards

The solution includes three optional additional tools:

- **Prometheus**: For kubernetes cluster metrics collection like CPU, memory, etc and sending to Mimir.
- **Promtail**: Collects container logs (stdout/stderr) and sends them to Loki
- **OpenTelemetry Collector**: Collects and processes metrics, logs, and traces for backend delivery

## Architecture

![LGTM Architecture](./assets/images/lgtm-architecture.png)

## 🚀 Quick Start Guide

### ✨ Prerequisites
- Helm v3+ (package manager)
- kubectl
- For GCP: gcloud CLI with project owner permissions

### 📦 Core Installation
```bash
# Add repositories & create namespace
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
kubectl create ns monitoring

# Install base components
helm install prometheus-operator --version 66.3.1 -n monitoring \
prometheus-community/kube-prometheus-stack -f values-prometheus.yaml
```

### 🔄 Choose Your Environment

#### Local Development (k3s, minikube)

For local testing and development scenarios. Uses local storage via MinIO.

```bash
helm install lgtm --version 2.1.0 -n monitoring \
grafana/lgtm-distributed -f values-lgtm.local.yaml
```

#### GCP Production Setup
1. Set up GCP resources:

```bash
# Set your project ID
export PROJECT_ID=your-project-id

# Create buckets with random suffix
export BUCKET_SUFFIX=$(openssl rand -hex 4)
for bucket in logs traces metrics metrics-admin; do
gsutil mb -p ${PROJECT_ID} -c standard -l us-east1 gs://lgtm-${bucket}-${BUCKET_SUFFIX}
done

# Update bucket names in config
sed -i -e "s/lgtm-\(.*\)$/lgtm-\1-${BUCKET_SUFFIX}/g" values-lgtm.yaml

# Create and configure service account
gcloud iam service-accounts create lgtm-monitoring \
--display-name "LGTM Monitoring" \
--project ${PROJECT_ID}

# Set permissions
for bucket in logs traces metrics metrics-admin; do
gsutil iam ch serviceAccount:lgtm-monitoring@${PROJECT_ID}.iam.gserviceaccount.com:admin \
gs://lgtm-${bucket}-${BUCKET_SUFFIX}
done

# Create service account key and secret
gcloud iam service-accounts keys create key.json \
--iam-account lgtm-monitoring@${PROJECT_ID}.iam.gserviceaccount.com
kubectl create secret generic lgtm-sa --from-file=key.json -n monitoring
```

2. Install LGTM stack:

Change values-lgtm.yaml according to your needs before applying.

```bash
helm install lgtm --version 2.1.0 -n monitoring \
grafana/lgtm-distributed -f values-lgtm.yaml
```

## 📊 Verification & Testing

### Access Grafana
```bash
# Access dashboard
kubectl port-forward svc/lgtm-grafana 3000:80 -n monitoring

# Get password credentials
kubectl get secret --namespace default grafana -o jsonpath="{.data.admin-password}" | base64 --decode
```
- Default username: `admin`
- Access URL: http://localhost:3000

### Component Testing

#### 📝 Loki (Logs)
```bash
# Forward Loki port
kubectl port-forward svc/lgtm-loki-distributor 3100:3100 -n monitoring

# Send test log
curl -XPOST http://localhost:3100/loki/api/v1/push -H "Content-Type: application/json" -d '{
"streams": [{
"stream": { "job": "test", "level": "info" },
"values": [[ "'$(date +%s)000000'", "Test log message" ]]
}]
}'
```

#### 📈 Tempo (Traces)
```bash
# Forward Tempo port
kubectl port-forward svc/lgtm-tempo-distributor 4317:4317 -n monitoring

# Generate test traces
docker run jaegertracing/jaeger-tracegen -service test -traces 10
```

#### 📊 Mimir (Metrics)
Verify through Grafana dashboards - pre-configured metrics are automatically collected.

## 🔧 Additional Components

### Telemetry Collection

For data collection and aggregation:

```bash
# Install Promtail for container logs
kubectl apply -f manifests/promtail.yaml

# Install OpenTelemetry Collector
kubectl apply -f manifests/otel-collector.yaml
```