<p>I am trying to create a file with in a POD from kubernetes sceret, but i am facing one issue like, i am not able to change permission of my deployed files.</p>

<p>I am getting below error,
<strong>chmod: changing permissions of '/root/.ssh/id_rsa': Read-only file system</strong></p>

<p>I have already apply defaultmode &amp; mode for the same but still it is not working.</p>

<pre><code>volumes:
- name: gitsecret
  secret:
    secretName: git-keys
VolumeMounts:
- mountPath: "/root/.ssh"
  name: gitsecret
  readOnly: false
</code></pre>

<p>thank you</p>

<p>As you stated, your version of Kubernetes is 1.10 and documentation for it is available <a href="https://v1-10.docs.kubernetes.io/docs/" rel="noreferrer">here</a></p>

<p>You can have a look at the github link <a href="https://stackoverflow.com/users/9705485/ryan-dawson">@RyanDawson</a> provided, there you will be able to find that this <code>RO</code> flag for <code>configMap</code> and <code>secrets</code> was intentional. It can be disabled using feature gate <code>ReadOnlyAPIDataVolumes</code>.
You can follow this guide on how to <a href="https://docs.okd.io/latest/admin_guide/disabling_features.html" rel="noreferrer">Disabling Features Using Feature Gates</a>.</p>

<p>As a workaround, you can try this approach:</p>

<pre><code>containers:
  - name: apache
    image: apache:2.4
    lifecycle:
      postStart:
        exec:
          command: ["chown", "www-data:www-data", "/var/www/html/app/etc/env.php"]
</code></pre>

<p>You can find explanation inside Kubernetes docs <a href="https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/" rel="noreferrer">Attach Handlers to Container Lifecycle Events</a></p>
