devops/prometheus/install-prometheus.sh

19 lines
524 B
Bash
Raw Normal View History

2025-09-10 15:34:13 +08:00
#!/bin/bash
set -euo pipefail
echo "开始安装 Prometheus..."
sudo chown -R 65534:65534 /opt/prometheus/data
kubectl apply -f prometheus-configmap.yaml
kubectl apply -f prometheus-rbac.yaml
kubectl apply -f prometheus-deployment.yaml
kubectl apply -f prometheus-service.yaml
kubectl apply -f prometheus-ingress.yaml
echo "等待 Prometheus 启动..."
kubectl wait --for=condition=available --timeout=300s deployment/prometheus
echo "Prometheus 安装完成!"
echo "查看状态: kubectl get pods -l app=prometheus"