From 82ba268f622ea7198a954dcf922d06f2bafc523e Mon Sep 17 00:00:00 2001 From: ExQz Date: Tue, 30 Jun 2026 09:43:22 +0300 Subject: [PATCH] Added Grafana deployment --- Grafana/grafana_datasource.yaml | 17 +++++++++++ Grafana/grafana_deployment.yaml | 54 +++++++++++++++++++++++++++++++++ Grafana/grafana_ingress.yaml | 20 ++++++++++++ Grafana/grafana_pvc.yaml | 12 ++++++++ Grafana/grafana_service.yaml | 13 ++++++++ 5 files changed, 116 insertions(+) create mode 100644 Grafana/grafana_datasource.yaml create mode 100644 Grafana/grafana_deployment.yaml create mode 100644 Grafana/grafana_ingress.yaml create mode 100644 Grafana/grafana_pvc.yaml create mode 100644 Grafana/grafana_service.yaml diff --git a/Grafana/grafana_datasource.yaml b/Grafana/grafana_datasource.yaml new file mode 100644 index 0000000..566d902 --- /dev/null +++ b/Grafana/grafana_datasource.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: grafana-datasources + namespace: monitoring + labels: + grafana_datasource: "1" +data: + prometheus-datasource.yaml: | + apiVersion: 1 + datasources: + - name: Prometheus + type: prometheus + access: proxy + url: http://prometheus-1768991433-server.monitoring.svc.cluster.local:80 + isDefault: true + editable: true \ No newline at end of file diff --git a/Grafana/grafana_deployment.yaml b/Grafana/grafana_deployment.yaml new file mode 100644 index 0000000..0c2e743 --- /dev/null +++ b/Grafana/grafana_deployment.yaml @@ -0,0 +1,54 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: grafana + namespace: monitoring +spec: + replicas: 1 + selector: + matchLabels: + app: grafana + template: + metadata: + labels: + app: grafana + spec: + securityContext: + fsGroup: 472 + containers: + - name: grafana + image: docker.io/grafana/grafana:latest + imagePullPolicy: IfNotPresent + ports: + - name: http + containerPort: 3000 + env: + - name: GF_SECURITY_ADMIN_USER + valueFrom: + secretKeyRef: + name: grafana-admin-secret + key: admin-user + - name: GF_SECURITY_ADMIN_PASSWORD + valueFrom: + secretKeyRef: + name: grafana-admin-secret + key: admin-password + - name: GF_SERVER_ROOT_URL + value: "https://grafana.mariushome.lt/" + - name: GF_SERVER_DOMAIN + value: "grafana.mariushome.lt" + - name: GF_USERS_ALLOW_SIGN_UP + value: "false" + volumeMounts: + - name: grafana-data + mountPath: /var/lib/grafana + - name: grafana-datasources + mountPath: /etc/grafana/provisioning/datasources + readOnly: true + volumes: + - name: grafana-data + persistentVolumeClaim: + claimName: grafana-hetzner-pvc + - name: grafana-datasources + configMap: + name: grafana-datasources \ No newline at end of file diff --git a/Grafana/grafana_ingress.yaml b/Grafana/grafana_ingress.yaml new file mode 100644 index 0000000..c52d80a --- /dev/null +++ b/Grafana/grafana_ingress.yaml @@ -0,0 +1,20 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: grafana + namespace: monitoring + annotations: + ingress.cilium.io/loadbalancer-mode: "dedicated" +spec: + ingressClassName: cilium + rules: + - host: "grafana.mariushome.lt" + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: grafana + port: + number: 3000 \ No newline at end of file diff --git a/Grafana/grafana_pvc.yaml b/Grafana/grafana_pvc.yaml new file mode 100644 index 0000000..06807e1 --- /dev/null +++ b/Grafana/grafana_pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: grafana-hetzner-pvc + namespace: monitoring +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + storageClassName: slow \ No newline at end of file diff --git a/Grafana/grafana_service.yaml b/Grafana/grafana_service.yaml new file mode 100644 index 0000000..969872d --- /dev/null +++ b/Grafana/grafana_service.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Service +metadata: + name: grafana + namespace: monitoring +spec: + selector: + app: grafana + ports: + - name: http + protocol: TCP + port: 3000 + targetPort: http \ No newline at end of file