apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana
  labels:
    app: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
      annotations:
        prometheus.io/scrape: 'false'
    spec:
      containers:
        - name: grafana
          image: "grafana/grafana:7.2.1"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 3000
              protocol: TCP
          env:
            - name: GF_PATHS_PROVISIONING
              value: /etc/grafana/provisioning/
            - name: GF_AUTH_BASIC_ENABLED
              value: "false"
            - name: GF_AUTH_ANONYMOUS_ENABLED
              value: "true"
            - name: GF_AUTH_ANONYMOUS_ORG_ROLE
              value: Admin
            - name: GF_USERS_DEFAULT_THEME
              value: "light"
          volumeMounts:
            - name: grafana
              mountPath: /var/lib/grafana
            - name: dashboards
              mountPath: /etc/grafana/dashboards
            - name: datasources
              mountPath: /etc/grafana/provisioning/datasources
            - name: providers
              mountPath: /etc/grafana/provisioning/dashboards
          resources:
            {}
      volumes:
        - name: grafana
          emptyDir: {}
        - name: dashboards
          configMap:
            name: grafana-dashboards
        - name: providers
          configMap:
            name: grafana-providers
        - name: datasources
          configMap:
            name: grafana-datasources