1
0
Fork 0
home-stack-kustomize/kustomize/bases/grafana/grafana-deployment.yaml

121 lines
3.3 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: server
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
valueFrom:
configMapKeyRef:
name: kustomize-generated-config
key: GRAFANA_EXTERNAL_HOST
- name: GF_SERVER_ROOT_URL
valueFrom:
configMapKeyRef:
name: kustomize-generated-config
key: GRAFANA_EXTERNAL_URL
# - name: GF_AUTH_ANONYMOUS_ENABLED
# value: "true"
- name: GF_INSTALL_PLUGINS
value: marcusolsson-json-datasource,marcusolsson-treemap-panel
- name: GF_FEATURE_TOGGLES_ENABLE
value: nestedFolders
- name: GF_AUTH_GENERIC_OAUTH_SKIP_ORG_ROLE_SYNC
value: "true"
- name: GF_AUTH_OAUTH_ALLOW_INSECURE_EMAIL_LOOKUP
value: "true"
args: ['--config', '/etc/grafana/provisioning/config/custom.ini']
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: 500m
memory: 500Mi
limits:
cpu: 500m
memory: 500Mi
volumeMounts:
- name: grafana-datasources
mountPath: /etc/grafana/provisioning/datasources
- name: grafana-config
mountPath: /etc/grafana/provisioning/config
- mountPath: /var/lib/grafana
name: grafana-pv
volumes:
- name: grafana-datasources
configMap:
name: grafana-datasources
- name: grafana-config
secret:
secretName: grafana-config
- name: grafana-pv
persistentVolumeClaim:
claimName: server-pvc
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: server-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: v1
kind: Service
metadata:
name: server
labels:
app.kubernetes.io/name: grafana
monitor: prometheus
spec:
selector:
app.kubernetes.io/name: grafana
ports:
- name: http
port: 3000
targetPort: http