apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana-deployment
  labels:
    app: grafana
spec:
 replicas: 1
 selector:
   matchLabels:
     app: grafana
 template:
   metadata:
     labels:
       app: grafana
   spec:
     containers:
       - name: grafana
         image: grafana/grafana
         ports:
           - containerPort: 3000
         env:
           - name: CACERT
             valueFrom:
              secretKeyRef:
                name: elasticsearch-es-http-certs-public
                key: ca.crt
           - name: ES_PASS
             valueFrom:
              secretKeyRef:
                name: elasticsearch-es-elastic-user
                key: elastic
         volumeMounts:
           - name: grafana-config
             mountPath: /etc/grafana/grafana.ini
             subPath: grafana.ini
           - name: datasources
             mountPath: /etc/grafana/provisioning/datasources/datasource.yaml
             subPath: datasource.yaml
     volumes:
       - name: grafana-config
         configMap:
           name: grafana-config
       - name: datasources
         configMap:
           name: datasources-config


      
