apiVersion: v1
kind: Service
metadata:
  annotations:
    prometheus.io/scrape: 'true'
  labels:
    app: grafana
    name: grafana
  name: grafana
spec:
  ports:
  - name: scrape
    port: 3000
    protocol: TCP
    nodePort: 30902
  selector:
    app: grafana
  type: NodePort
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: grafana-dashboards
data:
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: grafana
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: grafana
    spec:
      volumes:
      - name: grafana-storage
        emptyDir: {}
      - name: grafana-dashboards
        configMap:
          name: grafana-dashboards
      containers:
      - name: grafana
        image: grafana/grafana:3.1.1
        volumeMounts:
        - name: grafana-storage
          mountPath: /var/grafana-storage
        ports:
        - containerPort: 3000
        resources:
          requests:
            memory: 100Mi
            cpu: 100m
          limits:
            memory: 200Mi
            cpu: 200m
      - name: grafana-watcher
        image: quay.io/coreos/grafana-watcher:latest
        imagePullPolicy: Never
        args:
          - '--watch-dir=/var/grafana-dashboards'
          - '--grafana-url=http://admin:admin@localhost:3000'
        volumeMounts:
        - name: grafana-dashboards
          mountPath: /var/grafana-dashboards
        resources:
          requests:
            memory: "16Mi"
            cpu: "50m"
          limits:
            memory: "32Mi"
            cpu: "100m"
        volumeMounts:
        - name: grafana-dashboards
          mountPath: /var/grafana-dashboards

