devops/grafana/install-grafana.sh

20 lines
555 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -euo pipefail
echo "开始安装 Grafana..."
sudo chown -R 65534:65534 /opt/prometheus/data
kubectl apply -f grafana-datasource.yaml
kubectl apply -f grafana-dash-provisioning.yaml
kubectl apply -f grafana-deployment.yaml
kubectl apply -f grafana-service.yaml
kubectl apply -f grafana-ingress.yaml
echo "等待 Grafana 启动..."
kubectl wait --for=condition=available --timeout=300s deployment/grafana
echo "Grafana 安装完成!"
echo "查看状态: kubectl get pods -l app=grafana"
默认用户名admin
默认密码admin123