103 lines
2.6 KiB
YAML
103 lines
2.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: grafana
|
|
labels:
|
|
app.kubernetes.io/name: grafana
|
|
spec:
|
|
replicas: 1 # we can only have 1 replica for as long as the database is sqlite
|
|
strategy:
|
|
type: Recreate
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: grafana
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: grafana
|
|
spec:
|
|
initContainers:
|
|
- name: init-ownership
|
|
image: bash:5
|
|
command: ['chown', '-R', '472:472', '/var/lib/grafana']
|
|
volumeMounts:
|
|
- mountPath: /var/lib/grafana
|
|
name: grafana-pv
|
|
containers:
|
|
- name: grafana
|
|
image: grafana/grafana
|
|
env:
|
|
- name: GF_SERVER_DOMAIN
|
|
value: ${GRAFANA_EXTERNAL_HOST}
|
|
# - name: GF_AUTH_ANONYMOUS_ENABLED
|
|
# value: "true"
|
|
- name: GF_INSTALL_PLUGINS
|
|
value: marcusolsson-json-datasource,marcusolsson-treemap-panel
|
|
- name: GF_FEATURE_TOGGLES_ENABLE
|
|
value: ngalert
|
|
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
|
|
ports:
|
|
- name: http
|
|
containerPort: 3000
|
|
resources:
|
|
requests:
|
|
cpu: 250m
|
|
memory: 250Mi
|
|
limits:
|
|
cpu: 250m
|
|
memory: 250Mi
|
|
volumeMounts:
|
|
- name: grafana-datasources
|
|
mountPath: /etc/grafana/provisioning/datasources
|
|
- mountPath: /var/lib/grafana
|
|
name: grafana-pv
|
|
volumes:
|
|
- name: grafana-datasources
|
|
configMap:
|
|
name: grafana-datasources
|
|
- name: grafana-pv
|
|
persistentVolumeClaim:
|
|
claimName: grafana-pvc
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: grafana-pvc
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: grafana
|
|
labels:
|
|
app.kubernetes.io/name: grafana
|
|
monitor: prometheus
|
|
spec:
|
|
selector:
|
|
app.kubernetes.io/name: grafana
|
|
ports:
|
|
- name: http
|
|
port: 3000
|
|
targetPort: http |