简体   繁体   中英

Persistent volume claim attach to kubernetes deployment to access files present in PVC but should not write any logs to PVC?

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.

Can you please let me know how can i achieve it?

I Created a PVC and attached it a deployment but it is writing logs and configurations to it.

You can use the GCP fuse and store files to S3 directly that way it would be a little easy to manage if it's works for you.

However, if you want to go with your Idea you have to implement the ReadWriteMany ( Read More ). So two POD can attach to one PVC and one write and the other one read.

You can also use the EFS, or NFS file systems GKE with Filestore from GCP or MinIO , GlusterFS .

Ref answer glusterfs

I Created a PVC and attached it a deployment but it is writing logs and configurations to it.

volumeMounts:
          - name: file
            mountPath: /var/data
            readOnly: true

You can set the mode when mounting the file or directory and set it as read-only mode also readOnly: true .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM