| apiVersion: v1 |
| kind: Service |
| metadata: |
| name: grafana |
| annotations: |
| beta.cloud.google.com/backend-config: '{"ports": {"8000":"skia-default-backendconfig"}}' |
| skia.org.domain: grafana2.skia.org |
| spec: |
| selector: |
| app: grafana |
| type: NodePort |
| ports: |
| - port: 8000 |
| name: http |
| --- |
| apiVersion: apps/v1beta1 |
| kind: StatefulSet |
| metadata: |
| name: grafana |
| spec: |
| replicas: 1 |
| updateStrategy: |
| type: RollingUpdate |
| serviceName: "grafana" |
| template: |
| metadata: |
| labels: |
| app: grafana |
| annotations: |
| prometheus.io.scrape: "true" |
| prometheus.io.port: "10000" |
| spec: |
| automountServiceAccountToken: false |
| securityContext: |
| runAsUser: 2000 # aka skia |
| fsGroup: 2000 # aka skia |
| containers: |
| - name: grafana |
| image: grafana/grafana:5.4.2 |
| env: |
| # Grafana lets environment variables overwrite some values in the |
| # .ini files. But then they go and set those environment variables |
| # in their Dockerfile, so we have to set them here because env |
| # variables are applied after the .ini config files. |
| - name: GF_PATHS_CONFIG |
| value: /etc/grafana/grafana.ini |
| - name: GF_PATHS_DATA |
| value: /mnt/grafana |
| - name: GF_PATHS_HOME |
| value: /usr/share/grafana |
| - name: GF_PATHS_LOGS |
| value: /dev/stdout |
| ports: |
| - containerPort: 8000 |
| readinessProbe: |
| httpGet: |
| path: /metrics |
| port: 8000 |
| initialDelaySeconds: 1 |
| periodSeconds: 3 |
| volumeMounts: |
| - name: grafana-ini |
| mountPath: /etc/grafana/ |
| - name: grafana-storage-volume-claim |
| mountPath: /mnt/grafana/ |
| resources: |
| requests: |
| memory: "100Mi" |
| cpu: "100m" |
| ports: |
| - containerPort: 8000 |
| - name: backup-to-gcs |
| args: |
| - --input=/mnt/grafana/grafana.db |
| - --bucket=skia-public-backup |
| - --output=grafana |
| - --logtostderr |
| - --prom_port=:10000 |
| image: gcr.io/skia-public/backup-to-gcs:2019-02-22T21_28_21Z-jcgregorio-a8bf641-clean |
| volumeMounts: |
| - name: skia-backup-to-gcs-sa |
| mountPath: /var/secrets/google |
| - name: grafana-storage-volume-claim |
| mountPath: /mnt/grafana/ |
| readOnly: true |
| resources: |
| requests: |
| memory: "30Mi" |
| cpu: "10m" |
| env: |
| - name: GOOGLE_APPLICATION_CREDENTIALS |
| value: /var/secrets/google/key.json |
| ports: |
| - containerPort: 10000 |
| volumes: |
| - name: grafana-ini |
| secret: |
| secretName: grafana-ini |
| - name: skia-backup-to-gcs-sa |
| secret: |
| secretName: skia-backup-to-gcs |
| volumeClaimTemplates: |
| - metadata: |
| name: grafana-storage-volume-claim |
| spec: |
| accessModes: [ "ReadWriteOnce" ] |
| resources: |
| requests: |
| storage: 20Gi |