Kubernete的ConfigMap是否可写? [英] Are Kubernete's ConfigMaps Writable?
问题描述
是否可以直接修改configMap
挂载的文件?我们有一个应用程序读取一个configMap
类型的配置文件,并且如果该configMap
与其他Pod共享并且该Pod重新启动时,该应用程序应该能够编辑该文件,并且更改应保留.
Is it possible to directly modify the file mounted by configMap
? We have an application that reads a configuration file that was configMap
type and the application should able to edit the file and the changes should be persisted if the configMap
is shared with other pods and when the pod restarts.
如果configMap
并非为此目的,那么我们应该在consul
上中继什么以保存配置?
If configMap
is not meant for this, then what should we relay on consul
to save the configuration?
推荐答案
是的,配置映射是可以写.如果要与configmap中的文件进行交互,则可以将文件放在可写的卷中,然后例如redis 或hazelcast.
Yes a configmap is not intended to be writeable. If you're interacting with files from a configmap then you could instead put the files in a writeable volume and mount the volume. Or you could, as you suggest, use centralised configuration like consul. Given, that the app is dynamically writing to this data you could consider it state rather than configuration. Then it could be stored in a database. Another option could be a distributed cache such as redis or hazelcast.
这篇关于Kubernete的ConfigMap是否可写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!