[英]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.我需要将文件存储在 PVC 中并将该 PVC 附加到 Nginx 入口 controller 部署,以便应用程序可以访问 PVC 中存在的文件,但同时应用程序不应将日志和配置写回 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.我创建了一个 PVC 并将其附加到部署中,但它正在向其写入日志和配置。
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.您可以使用GCP fuse并将文件直接存储到S3 ,如果它适合您,那么管理起来会有点容易。
However, if you want to go with your Idea you have to implement the ReadWriteMany ( Read More ).但是,如果你想 go 与你的想法,你必须实施ReadWriteMany (阅读更多)。 So two POD can attach to one PVC and one write and the other one read.
所以两个POD可以附加到一个PVC ,一个写入,另一个读取。
You can also use the EFS, or NFS file systems GKE with Filestore from GCP or MinIO , GlusterFS .您还可以将 EFS 或 NFS 文件系统GKE 与来自 GCP 或MinIO 、 GlusterFS的 Filestore 一起使用。
Ref answer glusterfs参考答案 glusterfs
I Created a PVC and attached it a deployment but it is writing logs and configurations to it.
我创建了一个 PVC 并将其附加到部署中,但它正在向其写入日志和配置。
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
.挂载文件或目录时可以设置模式,设置为只读模式也可以设置为
readOnly: true
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.