2020-05-18 18:55:58 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: Deployment
|
|
|
|
metadata:
|
2020-05-18 20:18:39 +00:00
|
|
|
name: grafana
|
2020-05-31 22:05:21 +00:00
|
|
|
labels:
|
2021-08-26 16:42:32 +00:00
|
|
|
app.kubernetes.io/name: grafana
|
2020-05-18 18:55:58 +00:00
|
|
|
spec:
|
2021-08-26 16:42:48 +00:00
|
|
|
replicas: 1 # we can only have 1 replica for as long as the database is sqlite
|
|
|
|
strategy:
|
|
|
|
type: Recreate
|
2020-05-18 18:55:58 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
2021-08-26 16:42:32 +00:00
|
|
|
app.kubernetes.io/name: grafana
|
2020-05-18 18:55:58 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2021-08-26 16:42:32 +00:00
|
|
|
app.kubernetes.io/name: grafana
|
2020-05-18 18:55:58 +00:00
|
|
|
spec:
|
2021-08-28 20:32:06 +00:00
|
|
|
initContainers:
|
|
|
|
- name: init-ownership
|
|
|
|
image: bash:5
|
|
|
|
command: ['chown', '-R', '472:472', '/var/lib/grafana']
|
|
|
|
volumeMounts:
|
|
|
|
- mountPath: /var/lib/grafana
|
|
|
|
name: grafana-pv
|
2020-05-18 18:55:58 +00:00
|
|
|
containers:
|
|
|
|
- name: grafana
|
|
|
|
image: grafana/grafana
|
|
|
|
env:
|
2021-09-11 03:30:38 +00:00
|
|
|
- name: GF_SERVER_DOMAIN
|
|
|
|
value: ${GRAFANA_EXTERNAL_HOST}
|
2022-08-28 22:29:26 +00:00
|
|
|
- name: GF_SERVER_ROOT_URL
|
|
|
|
value: https://${GRAFANA_EXTERNAL_HOST}/
|
2021-09-11 03:30:38 +00:00
|
|
|
# - name: GF_AUTH_ANONYMOUS_ENABLED
|
|
|
|
# value: "true"
|
2021-09-06 20:39:49 +00:00
|
|
|
- name: GF_INSTALL_PLUGINS
|
|
|
|
value: marcusolsson-json-datasource,marcusolsson-treemap-panel
|
2022-08-28 22:29:26 +00:00
|
|
|
args: ['--config', '/etc/grafana/provisioning/config/custom.ini']
|
2021-08-26 16:42:28 +00:00
|
|
|
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
|
2020-05-18 18:55:58 +00:00
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
containerPort: 3000
|
2021-08-26 16:42:28 +00:00
|
|
|
resources:
|
|
|
|
requests:
|
2022-11-04 21:28:01 +00:00
|
|
|
cpu: 500m
|
|
|
|
memory: 500Mi
|
2021-08-26 16:42:44 +00:00
|
|
|
limits:
|
2022-11-04 21:28:01 +00:00
|
|
|
cpu: 500m
|
|
|
|
memory: 500Mi
|
2020-05-18 18:55:58 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: grafana-datasources
|
|
|
|
mountPath: /etc/grafana/provisioning/datasources
|
2022-08-28 22:29:26 +00:00
|
|
|
- name: grafana-config
|
|
|
|
mountPath: /etc/grafana/provisioning/config
|
2021-08-26 16:42:28 +00:00
|
|
|
- mountPath: /var/lib/grafana
|
|
|
|
name: grafana-pv
|
2020-05-18 18:55:58 +00:00
|
|
|
volumes:
|
|
|
|
- name: grafana-datasources
|
|
|
|
configMap:
|
|
|
|
name: grafana-datasources
|
2022-08-28 22:29:26 +00:00
|
|
|
- name: grafana-config
|
|
|
|
secret:
|
|
|
|
secretName: grafana-config
|
2021-08-26 16:42:28 +00:00
|
|
|
- name: grafana-pv
|
|
|
|
persistentVolumeClaim:
|
|
|
|
claimName: grafana-pvc
|
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: PersistentVolumeClaim
|
|
|
|
metadata:
|
|
|
|
name: grafana-pvc
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteOnce
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: 1Gi
|
2020-05-18 18:55:58 +00:00
|
|
|
---
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Service
|
|
|
|
metadata:
|
|
|
|
name: grafana
|
2020-05-31 22:05:21 +00:00
|
|
|
labels:
|
2021-08-26 16:42:32 +00:00
|
|
|
app.kubernetes.io/name: grafana
|
|
|
|
monitor: prometheus
|
2020-05-18 18:55:58 +00:00
|
|
|
spec:
|
|
|
|
selector:
|
2021-08-26 16:42:32 +00:00
|
|
|
app.kubernetes.io/name: grafana
|
2020-05-18 18:55:58 +00:00
|
|
|
ports:
|
|
|
|
- name: http
|
|
|
|
port: 3000
|
2020-08-02 03:40:27 +00:00
|
|
|
targetPort: http
|