apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-deployment
  namespace: monitoring-system
  labels:
    app.kubernetes.io/name: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: grafana
  template:
    metadata:
      labels:
        app.kubernetes.io/name: grafana
    spec:
      containers:
      - name: grafana
        image: grafana/grafana:7.3.2
        imagePullPolicy: IfNotPresent
        env:
        - name: GF_PATHS_CONFIG
          value: /etc/grafana/config.ini
        ports:
        - name: web
          containerPort: 3000
        volumeMounts:
        - name: conf
          mountPath: /etc/grafana
          readOnly: true
        - name: provisioning-datasources
          mountPath: /etc/grafana/provisioning/datasources
          readOnly: true
        - name: provisioning-dashboards
          mountPath: /etc/grafana/provisioning/dashboards
          readOnly: true
        - name: dashboards
          mountPath: /etc/dashboards
          readOnly: true
      restartPolicy: Always
      volumes:
      - name: conf
        configMap:
          name: grafana-config
      - name: provisioning-datasources
        configMap:
          name: grafana-provisioning-datasources
      - name: provisioning-dashboards
        configMap:
          name: grafana-provisioning-dashboards
      - name: dashboards
        configMap:
          name: grafana-dashboards-general
