forked from k-space/kube
136 lines
3.1 KiB
YAML
136 lines
3.1 KiB
YAML
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: grafana-config
|
|
data:
|
|
grafana.ini: |
|
|
[log]
|
|
level = warn
|
|
[server]
|
|
domain = grafana.k-space.ee
|
|
root_url = https://%(domain)s/
|
|
[auth.generic_oauth]
|
|
name = OAuth
|
|
icon = signin
|
|
enabled = true
|
|
client_id = grafana
|
|
scopes = openid profile email groups
|
|
empty_scopes = false
|
|
auth_url = https://auth.k-space.ee/api/oidc/authorize
|
|
token_url = https://auth.k-space.ee/api/oidc/token
|
|
api_url = https://auth.k-space.ee/api/oidc/userinfo
|
|
allow_sign_up = true
|
|
role_attribute_path = contains(groups[*], 'Grafana Admins') && 'Admin' || 'Viewer'
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
labels:
|
|
app: grafana
|
|
name: grafana
|
|
spec:
|
|
revisionHistoryLimit: 0
|
|
serviceName: grafana
|
|
selector:
|
|
matchLabels:
|
|
app: grafana
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: grafana
|
|
spec:
|
|
securityContext:
|
|
fsGroup: 472
|
|
containers:
|
|
- name: grafana
|
|
image: grafana/grafana:8.5.0
|
|
securityContext:
|
|
readOnlyRootFilesystem: true
|
|
runAsNonRoot: true
|
|
runAsUser: 472
|
|
envFrom:
|
|
- secretRef:
|
|
name: oidc-secret
|
|
ports:
|
|
- containerPort: 3000
|
|
name: http-grafana
|
|
protocol: TCP
|
|
readinessProbe:
|
|
failureThreshold: 3
|
|
httpGet:
|
|
path: /robots.txt
|
|
port: 3000
|
|
scheme: HTTP
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 30
|
|
successThreshold: 1
|
|
timeoutSeconds: 2
|
|
livenessProbe:
|
|
failureThreshold: 3
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
successThreshold: 1
|
|
tcpSocket:
|
|
port: 3000
|
|
timeoutSeconds: 1
|
|
resources:
|
|
requests:
|
|
cpu: 250m
|
|
memory: 750Mi
|
|
volumeMounts:
|
|
- mountPath: /var/lib/grafana
|
|
name: grafana-data
|
|
- mountPath: /etc/grafana
|
|
name: grafana-config
|
|
volumes:
|
|
- name: grafana-config
|
|
configMap:
|
|
name: grafana-config
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: grafana-data
|
|
spec:
|
|
storageClassName: longhorn
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: grafana
|
|
spec:
|
|
ports:
|
|
- port: 80
|
|
protocol: TCP
|
|
targetPort: http-grafana
|
|
selector:
|
|
app: grafana
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: Ingress
|
|
metadata:
|
|
name: grafana
|
|
annotations:
|
|
traefik.ingress.kubernetes.io/router.entrypoints: websecure
|
|
traefik.ingress.kubernetes.io/router.tls: "true"
|
|
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
|
|
spec:
|
|
rules:
|
|
- host: grafana.k-space.ee
|
|
http:
|
|
paths:
|
|
- pathType: Prefix
|
|
path: "/"
|
|
backend:
|
|
service:
|
|
name: grafana
|
|
port:
|
|
number: 80
|
|
tls:
|
|
- hosts:
|
|
- "*.k-space.ee"
|