apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana
  namespace: monitoring
  labels:
    app: grafana
spec:
  selector:
    matchLabels:
      app: grafana
  replicas: 1
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
        - name: grafana
          image: grafana/grafana:7.2.0
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 3000
          volumeMounts:
            - name: grafana-persistent-storage
              mountPath: /var/lib/grafana
          securityContext:
            runAsUser: 0
          env:
            - name: GF_INSTALL_PLUGINS
              value: "grafana-kubernetes-app,jdbranham-diagram-panel"
      volumes:
        - name: grafana-persistent-storage
          persistentVolumeClaim:
            claimName: grafana-pvc
