title: How do I copy a Kubernetes configmap to a write enabled area of a pod?
body: <p>I am trying to deploy a redis sentinel deployment in Kubernetes. I have accomplished that but want to use ConfigMaps to allow us to change the IP address of the master in the sentinel.conf file. I started this but redis cant write to the config file because the mount point for configMaps are readOnly. </p>
  
  <p>I was hoping to run an init container and copy the redis conf to a different dir just in the pod. But the init container couldn't find the conf file. </p>
  
  <p>What are my options? Init Container? Something other than ConfigMap? </p>
  
  <pre><code>apiVersion: apps/v1beta1
  kind: Deployment
  metadata:
    name: redis-sentinel
  spec:
    replicas: 3
    template:
      metadata:
        labels:
          app: redis-sentinel
      spec:
        hostNetwork: true
        containers:
        - name: redis-sentinel
          image: IP/redis-sentinel
          ports:
            - containerPort: 63790
            - containerPort: 26379
          volumeMounts:
            - mountPath: /redis-master-data
              name: data
            - mountPath: /usr/local/etc/redis/conf
              name: config
        volumes:
          - name: data
            emptyDir: {}
          - name: config
            configMap:
              name: sentinel-redis-config
              items:
              - key: redis-config-sentinel
                path: sentinel.conf
  </code></pre>