apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: grafana
  name: grafana
spec:
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      securityContext:
        fsGroup: 472
        supplementalGroups:
        - 0
      containers:
        - name: grafana
          image: grafana
          imagePullPolicy: Always
          args:
            - '--config=/etc/grafana/custom.ini'
          ports:
            - containerPort: 3000
              name: http
              protocol: TCP
          readinessProbe:
            httpGet:
              path: /robots.txt
              port: http
              scheme: HTTP
          livenessProbe:
            tcpSocket:
              port: http         
          resources:
            requests:
              cpu: 250m
              memory: 750Mi
          volumeMounts:
            - mountPath: /etc/grafana/custom.ini
              name: grafana-config
              subPath: custom.ini
              readOnly: true
            - mountPath: /var/lib/grafana
              name: grafana-pv
      volumes:
        - name: grafana-config
          configMap:
              name: grafana-config
        - name: grafana-pv
          persistentVolumeClaim:
            claimName: grafana-pvc
