<p>Here my configmap:</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
    name: chart-1591249502-zeppelin
    namespace: ra-iot-dev
    labels:
        helm.sh/chart: zeppelin-0.1.0
        app.kubernetes.io/name: zeppelin
        app.kubernetes.io/instance: chart-1591249502
        app.kubernetes.io/version: "0.9.0"
        app.kubernetes.io/managed-by: Helm
data:
  log4j.properties: |-
    log4j.rootLogger = INFO, dailyfile
    log4j.appender.stdout = org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
    log4j.appender.dailyfile.DatePattern=.yyyy-MM-dd
    log4j.appender.dailyfile.DEBUG = INFO
    log4j.appender.dailyfile = org.apache.log4j.DailyRollingFileAppender
    log4j.appender.dailyfile.File = ${zeppelin.log.file}
    log4j.appender.dailyfile.layout = org.apache.log4j.PatternLayout
    log4j.appender.dailyfile.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
    log4j.logger.org.apache.zeppelin.python=DEBUG
    log4j.logger.org.apache.zeppelin.spark=DEBUG
</code></pre>

<p>I'm trying to mount this file into <code>/zeppelin/conf/log4j.properties</code> pod directory file.</p>

<p>Here my deployment:</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: chart-1591249502-zeppelin
  labels:
    helm.sh/chart: zeppelin-0.1.0
    app.kubernetes.io/name: zeppelin
    app.kubernetes.io/instance: chart-1591249502
    app.kubernetes.io/version: "0.9.0"
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: zeppelin
      app.kubernetes.io/instance: chart-1591249502
  template:
    metadata:
      labels:
        app.kubernetes.io/name: zeppelin
        app.kubernetes.io/instance: chart-1591249502
    spec:
      serviceAccountName: chart-1591249502-zeppelin
      securityContext:
        {}
      containers:
        - name: zeppelin
          securityContext:
            {}
          image: "apache/zeppelin:0.9.0"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {}
          env:
            - name: ZEPPELIN_PORT
              value: "8080"
            - name: ZEPPELIN_K8S_CONTAINER_IMAGE
              value: apache/zeppelin:0.9.0
            - name: ZEPPELIN_RUN_MODE
              value: local
          volumeMounts:
            - name: log4j-properties-volume
              mountPath: /zeppelin/conf/log4j.properties
      volumes:
        - name: log4j-properties-volume
          configMap:
            name: chart-1591249502-zeppelin
            items:
              - key: log4j.properties
                path: keys
</code></pre>

<p>I'm getting this error event in kubernetes:</p>

<blockquote>
  <p>Error: failed to start container "zeppelin": Error response from daemon: oci runtime error: container_linux.go:247: starting container process caused "process_linux.go:364: container init caused \"rootfs_linux.go:54: mounting \\"/var/lib/origin/openshift.local.volumes/pods/63ac209e-a626-11ea-9e39-0050569f5f65/volumes/kubernetes.io~configmap/log4j-properties-volume\\" to rootfs \\"/var/lib/docker/overlay2/33f3199e46111afdcd64d21c58b010427c27761b02473967600fb95ab6d92e21/merged\\" at \\"/var/lib/docker/overlay2/33f3199e46111afdcd64d21c58b010427c27761b02473967600fb95ab6d92e21/merged/zeppelin/conf/log4j.properties\\" caused \\"not a directory\\"\"" : Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type</p>
</blockquote>

<p>Take in mind, that I only want to replace an existing file. I mean, into <code>/zeppelin/conf/</code> directory there are several files. I only want to replace <code>/zeppelin/conf/log4j.properties</code>.</p>

<p>Any ideas?</p>

<p>From logs I saw that you are working on <code>OpenShift</code>, however I was able to do it on <code>GKE</code>.</p>

<p>I've deployed pure zeppelin deployment form your example.</p>

<pre><code>zeppelin@chart-1591249502-zeppelin-557d895cd5-v46dt:~/conf$ cat log4j.properties
#
# Licensed to the Apache Software Foundation (ASF) under one or more
...
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
...
# limitations under the License.
#

log4j.rootLogger = INFO, stdout

log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
zeppelin@chart-1591249502-zeppelin-557d895cd5-v46dt:~/conf$ 
</code></pre>

<p>If you want to repleace one specific file, you need to use <a href="https://kubernetes.io/docs/concepts/storage/volumes/#using-subpath" rel="nofollow noreferrer">subPath</a>. There is also article with another example which can be found <a href="https://carlos.mendible.com/2019/02/10/kubernetes-mount-file-pod-with-configmap/" rel="nofollow noreferrer">here</a>.</p>

<p><strong>Issue 1. ConfigMap belongs to <code>namespace</code></strong></p>

<p>Your deployment did not contains any namespace so it was deployed in <code>default</code> namespace. <code>ConfigMap</code> included <code>namespace: ra-iot-dev</code>.</p>

<pre><code>$ kubectl api-resources
NAME                              SHORTNAMES   APIGROUP                       NAMESPACED   KIND
...
configmaps                        cm                                          true         ConfigMap
...
</code></pre>

<p>If you will keep this namespace, you will probably get error like:</p>

<pre><code>MountVolume.SetUp failed for volume "log4j-properties-volume" : configmap "chart-1591249502-zeppelin" not found
</code></pre>

<p><strong>Issue 2. subPath to replace file</strong></p>

<p>Ive changed one part in <code>deployment</code> (added <code>subPath</code>)</p>

<pre><code>    volumeMounts:
      - name: log4j-properties-volume
        mountPath: /zeppelin/conf/log4j.properties
        subPath: log4j.properties
volumes:
  - name: log4j-properties-volume
    configMap:
      name: chart-1591249502-zeppelin
</code></pre>

<p>and another in <code>ConfigMap</code> (removed namespace and set proper names)</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
    name: chart-1591249502-zeppelin
    labels:
        helm.sh/chart: zeppelin-0.1.0
        app.kubernetes.io/name: zeppelin
        app.kubernetes.io/instance: chart-1591249502
        app.kubernetes.io/version: "0.9.0"
        app.kubernetes.io/managed-by: Helm
data:
  log4j.properties: |-
...
</code></pre>

<p>After that output of the file looks like:</p>

<pre><code>$ kubectl exec -ti chart-1591249502-zeppelin-64495dcfc8-ccddr -- /bin/bash
zeppelin@chart-1591249502-zeppelin-64495dcfc8-ccddr:~$ cd conf
zeppelin@chart-1591249502-zeppelin-64495dcfc8-ccddr:~/conf$ ls
configuration.xsl  log4j.properties   log4j_yarn_cluster.properties  zeppelin-env.cmd.template  zeppelin-site.xml.template
interpreter-list   log4j.properties2  shiro.ini.template             zeppelin-env.sh.template
zeppelin@chart-1591249502-zeppelin-64495dcfc8-ccddr:~/conf$ cat log4j.properties
log4j.rootLogger = INFO, dailyfile
log4j.appender.stdout = org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
log4j.appender.dailyfile.DatePattern=.yyyy-MM-dd
log4j.appender.dailyfile.DEBUG = INFO
log4j.appender.dailyfile = org.apache.log4j.DailyRollingFileAppender
log4j.appender.dailyfile.File = ${zeppelin.log.file}
log4j.appender.dailyfile.layout = org.apache.log4j.PatternLayout
log4j.appender.dailyfile.layout.ConversionPattern=%5p [%d] ({%t} %F[%M]:%L) - %m%n
log4j.logger.org.apache.zeppelin.python=DEBUG
log4j.logger.org.apache.zeppelin.spark=DEBUGzeppelin@chart-1591249502-zeppelin-64495dcfc8-ccddr:~/conf$
</code></pre>
