title: Edit config file inside image before deployment/pod creation
body: <p>I am running grafana as a pod inside my Kubernetes cluster. Once Grafana is initialized, it create a DB on localhost and saves all data there. This means that whenever a pod is destroyed and recreated, the whole DB is reinitialized and I lose all previous Data.</p>
  
  <p>The grafana config inside the Pod for DB is ::</p>
  
  <pre><code>#################################### Database ####################################
  [database]
  # Either "mysql", "postgres" or "sqlite3", it's your choice
  ;type = sqlite3
  ;host = 127.0.0.1:3306
  ;name = grafana
  ;user = root
  ;password =
  </code></pre>
  
  <p>Inorder to get rid of this problem, I have to create an external DB and point my Grafana to use that DB instance everytime I create the Grafana Pod. My current default implementation to create the Grafana pod is ::</p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: lb-grafana-service
  spec:
    ports:
      - port: 4545
        targetPort: 4545
        protocol: TCP
    clusterIP: 10.100.10.100
  ----
  apiVersion: v1
  kind: Service
  metadata:
    annotations:
      prometheus.io/scrape: 'true'
    labels:
      app: grafana
      name: grafana
    name: grafana
  spec:
    ports:
    - name: scrape
      port: 4545
      nodePort: 30999
      protocol: TCP
    type: NodePort
    selector:
      app: grafana
  ----
  apiVersion: extensions/v1beta1
  kind: Deployment
  metadata:
      name: grafana
  spec:
    replicas: 1
    selector:
      matchLabels:
        app: grafana
    template:
      metadata:
        name: grafana
        labels:
          app: grafana
      spec:
        containers:
        - name: grafana
          image: grafana/grafana:develop
          env:
            - name: Prometheus_SERVICE_URL
              value: http://172.29.219.105:30901
            - name: GF_SECURITY_ADMIN_PASSWORD
              value: "grafana"
            - name: GF_SERVER_HTTP_PORT
              value: "4545"
          ports:
            - containerPort: 9101
          volumeMounts:
          - mountPath: /var
            name: grafana-storage
        volumes:
        - name: grafana-storage
          emptyDir: {}
  </code></pre>
  
  <p>So what I want to do is overwrite the <code>/etc/grafana/grafana.ini</code> file before Grafana pod comes online OR just rewrite the current file with new values. I have no idea how I can do that right now. A little guidance will be much appreciated. </p>