add gra link

This commit is contained in:
孙小云 2025-09-10 15:41:17 +08:00
parent 292b0ef8d4
commit 1197b1d73f
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasource
namespace: default
data:
datasource.yml: |
apiVersion: 1
datasources:
- name: Prometheus
type: prometheus
access: proxy
url: http://prometheus-service:9090
isDefault: true
editable: false

View File

@ -35,11 +35,17 @@ spec:
volumeMounts:
- name: grafana-storage
mountPath: /var/lib/grafana
- name: grafana-provisioning
mountPath: /etc/grafana/provisioning/datasources
readOnly: true
volumes:
- name: grafana-storage
hostPath:
path: /opt/grafana/data
type: DirectoryOrCreate
- name: grafana-provisioning
configMap:
name: grafana-datasource
---
apiVersion: v1
kind: Service

View File

@ -3,6 +3,7 @@ set -euo pipefail
echo "开始安装 Grafana..."
sudo chown -R 65534:65534 /opt/prometheus/data
kubectl apply -f grafana-datasource.yaml
kubectl apply -f grafana-deployment.yaml
kubectl apply -f grafana-service.yaml
kubectl apply -f grafana-ingress.yaml