apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: grafana
  name: grafana
  namespace: monitoring
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - image: gcr.io/k8s-testimages/grafana/grafana:6.2.0
        name: grafana
        ports:
        - containerPort: 3000
          name: http
        readinessProbe:
          httpGet:
            path: /api/health
            port: http
        resources:
          requests:
            cpu: 250m
            memory: 250Mi
        volumeMounts:
        - mountPath: /var/lib/grafana
          name: grafana-storage
          readOnly: false
        - mountPath: /etc/grafana/provisioning/datasources
          name: grafana-datasources
          readOnly: false
        - mountPath: /etc/grafana/provisioning/dashboards
          name: grafana-dashboards
          readOnly: false
        - mountPath: /grafana-dashboard-definitions/0/grafana-dashboard-network
          name: grafana-dashboard-network
          readOnly: false
        - mountPath: /grafana-dashboard-definitions/0/grafana-dashboard-master-dashboard
          name: grafana-dashboard-master-dashboard
          readOnly: false
        - mountPath: /grafana-dashboard-definitions/0/grafana-dashboard-slo
          name: grafana-dashboard-slo
          readOnly: false
        env:
          - name: GF_AUTH_ANONYMOUS_ENABLED
            value: "true"
          - name: GF_AUTH_ANONYMOUS_ORG_ROLE
            value: "Admin"
      nodeSelector:
        beta.kubernetes.io/os: linux
      securityContext:
        runAsNonRoot: true
        runAsUser: 65534
      serviceAccountName: grafana
      volumes:
      - emptyDir: {}
        name: grafana-storage
      - name: grafana-datasources
        secret:
          secretName: grafana-datasources
      - configMap:
          name: grafana-dashboards
        name: grafana-dashboards
      - configMap:
          name: grafana-dashboard-network
        name: grafana-dashboard-network
      - configMap:
          name: grafana-dashboard-master-dashboard
        name: grafana-dashboard-master-dashboard
      - configMap:
          name: grafana-dashboard-slo
        name: grafana-dashboard-slo
