<p>I have a requirement to store files in a PVC and attach that PVC to a Nginx ingress controller deployment so that application can access the files which are present in PVC but at the same application should not write back logs and configurations to PVC.</p>
<p>Can you please let me know how can i achieve it?</p>
<p>I Created a PVC and attached it a deployment but it is writing logs and configurations to it.</p>

<p>You can use the <a href="https://cloud.google.com/storage/docs/gcs-fuse" rel="nofollow noreferrer">GCP fuse</a> and <strong>store</strong> files to <strong>S3</strong> directly that way it would be a little easy to manage if it's works for you.</p>
<p>However, if you want to go with your Idea you have to implement the <strong>ReadWriteMany</strong> (<a href="https://stackoverflow.com/a/57798369/5525824">Read More</a>). So <strong>two</strong> <strong>POD</strong> can attach to one <strong>PVC</strong> and one write and the other one read.</p>
<p>You can also use the EFS, or NFS file systems <a href="https://cloud.google.com/community/tutorials/gke-filestore-dynamic-provisioning" rel="nofollow noreferrer">GKE with Filestore</a> from GCP or <a href="https://min.io/" rel="nofollow noreferrer">MinIO</a>, <a href="https://www.gluster.org/" rel="nofollow noreferrer">GlusterFS</a>.</p>
<p><a href="https://stackoverflow.com/a/68586922/5525824">Ref answer glusterfs</a></p>
<blockquote>
<p>I Created a PVC and attached it a deployment but it is writing logs
and configurations to it.</p>
</blockquote>
<pre><code>volumeMounts:
          - name: file
            mountPath: /var/data
            readOnly: true
</code></pre>
<p>You can set the <strong>mode</strong> when mounting the file or directory and set it as <strong>read-only</strong> mode also <code>readOnly: true</code>.</p>
