简体   繁体   English

持久卷声明附加到 kube.netes 部署以访问 PVC 中存在的文件,但不应将任何日志写入 PVC?

[英]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 或MinIOGlusterFS的 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.

相关问题 Kube.netes 从 GCE 持久磁盘卷配置 PVC 显示错误 - Kubernetes provisioning PVC from GCE Persistent disk volume shows error 如果我删除它的卷绑定到 PV 的 PVC 会怎样? - What happens if I delete a PVC that it's volume is bound to a PV? 找不到 Kube.netes 持久卷挂载 - Kubernetes Persistent Volume Mount not found 带有 EKS 集群的 PV 和 PVC - PV & PVC with EKS Cluster 如何在 GKE 中使用 ReadWriteMany 创建持久卷声明? - How do I create a persistent volume claim with ReadWriteMany in GKE? 我可以在不丢失数据的情况下将 PVC 的访问模式从 RWO(标准存储类)更改为 RWX(NFS 存储类)吗? - Can I change Access mode of PVC from RWO(Standard storageclass) to RWX(NFS storageclass) without losing data? PVC 绑定但未被 GKE 上的 pod 发现 - PVC bound but not found by pods on GKE 如何在 GKE 中查找哪个 pod 正在使用 Persistent Volume Claim - How to find which pod is using a Persistent Volume Claim in GKE 如何将持久性 EBS 卷附加到自动缩放组中使用的 EC2 Linux 启动模板? - How can I attach a persistent EBS volume to an EC2 Linux launch template that is used in an autoscaling group? 无法在已安装的卷 aws efs 上写入文件 - Cannot write files on mounted volume aws efs
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM