1
0
mirror of synced 2026-02-06 19:05:55 +00:00

Add Prom+Grafana monitoring stack

This commit is contained in:
stefanprodan
2020-08-04 15:40:38 +03:00
parent 1779714b0d
commit e86286722a
12 changed files with 295 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasources
namespace: gitops-system
data:
datasources.yaml: |-
apiVersion: 1
deleteDatasources:
- name: prometheus
datasources:
- name: prometheus
type: prometheus
access: proxy
url: http://prometheus:9090
isDefault: true
editable: true
version: 1

View File

@@ -0,0 +1,60 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: grafana
labels:
app: grafana
spec:
replicas: 1
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
annotations:
prometheus.io/scrape: 'false'
spec:
containers:
- name: grafana
image: "grafana/grafana:7.1.1"
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 3000
protocol: TCP
env:
- name: GF_PATHS_PROVISIONING
value: /etc/grafana/provisioning/
- name: GF_AUTH_BASIC_ENABLED
value: "false"
- name: GF_AUTH_ANONYMOUS_ENABLED
value: "true"
- name: GF_AUTH_ANONYMOUS_ORG_ROLE
value: Admin
- name: GF_DEFAULT_THEME
value: "Light"
volumeMounts:
- name: grafana
mountPath: /var/lib/grafana
- name: dashboards
mountPath: /etc/grafana/dashboards
- name: datasources
mountPath: /etc/grafana/provisioning/datasources
- name: providers
mountPath: /etc/grafana/provisioning/dashboards
resources:
{}
volumes:
- name: grafana
emptyDir: {}
- name: dashboards
configMap:
name: grafana-dashboards
- name: providers
configMap:
name: grafana-providers
- name: datasources
configMap:
name: grafana-datasources

View File

@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: gitops-system
resources:
- service.yaml
- deployment.yaml
- providers.yaml
- datasources.yaml
configMapGenerator:
- name: grafana-dashboards
files:
- dashboards/control-plane.json

View File

@@ -0,0 +1,17 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-providers
namespace: gitops-system
data:
providers.yaml: |+
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: ''
type: file
disableDeletion: false
editable: true
options:
path: /etc/grafana/dashboards

View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: gitops-system
labels:
app: grafana
spec:
type: ClusterIP
ports:
- port: 3000
targetPort: http
protocol: TCP
name: http
selector:
app: grafana