Files
2026-02-09 21:51:46 -08:00

37 lines
975 B
Bash
Executable File

#!/bin/bash
# Install Loki Stack for Logging
set -e
NAMESPACE="monitoring"
RELEASE_NAME="loki"
echo "📊 Installing Loki Stack..."
# Check prerequisites
command -v helm >/dev/null 2>&1 || { echo "❌ helm not found"; exit 1; }
command -v kubectl >/dev/null 2>&1 || { echo "❌ kubectl not found"; exit 1; }
# Create namespace
echo "📦 Creating namespace: $NAMESPACE"
kubectl create namespace "$NAMESPACE" --dry-run=client -o yaml | kubectl apply -f -
# Add Grafana Helm repo
echo "📥 Adding Grafana Helm repository..."
helm repo add grafana https://grafana.github.io/helm-charts
helm repo update
# Install Loki Stack
echo "🚀 Installing Loki Stack..."
helm upgrade --install "$RELEASE_NAME" grafana/loki-stack \
--namespace "$NAMESPACE" \
--create-namespace \
--values values.yaml \
--wait
echo "✅ Loki Stack installed successfully!"
echo ""
echo "📝 Access Grafana:"
echo " kubectl port-forward -n $NAMESPACE svc/$RELEASE_NAME-grafana 3000:80"