简体   繁体   English

是否可以在 kubernetes 部署中以读/写模式挂载文件

[英]Is it possible to mount a file in read/write mode in kubernetes deployment

I have application run inside the kuberentes pod that update the user configuration file and on every deployment it flush the data, as the file reside in a folder which cann't be mounted so I created the empty configmap to mount that file as configmap with subpath mounting and also set the defaultmode of file 777 but still my application is unable to update the content of the file.我在 kuberentes pod 中运行了更新用户配置文件的应用程序,并且在每次部署时它都会刷新数据,因为文件驻留在无法挂载的文件夹中,因此我创建了空配置映射以将该文件挂载为带有子路径的配置映射安装并设置文件 777 的默认模式,但我的应用程序仍然无法更新文件的内容。

Is there way I can mount a file with read/write permission enable for all user so my application can update the file at runtime.有没有办法可以为所有用户安装具有读/写权限的文件,以便我的应用程序可以在运行时更新文件。

No, a configmap mount is read-only since you need to go through the API to update things.不,配置映射挂载是只读的,因为您需要通过 API 来 go 更新内容。 If you just want scratch storage that is temporary you can use an emptyDir volume but it sounds like you want this to stick around so check out the docs on persistent volumes (https://kubernetes.io/docs/concepts/storage/persistent-volumes/ ).如果您只想要临时的临时存储,您可以使用 emptyDir 卷,但听起来您希望它保留下来,因此请查看有关持久卷的文档(https://kubernetes.io/docs/concepts/storage/persistent-卷/ )。 There's a lot of options and complexity, you'll need to work out what is the best match for your use case.有很多选项和复杂性,您需要找出最适合您的用例的匹配项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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