I have a Kubernetes deployment that uses a ConfigMap with some configuration of the data which is frequently updated. I am mounting configMap as the volume inside the pod ( readOnly: False ), and with a Python script that is also running inside the pod, I am trying to update the data in configMap by reading/writing it as a file system in Python. I can read the data but am not able to write/update the configMap with new data.
Keys in configMap : ["etdFile", "currRecCount"]
Error : OSError: [Errno 30] Read-only file system: '/configMap/etdFile'
How can I write/update config map data inside pod without using kubectl scripts ?
You can use the subPath option in your volume mount to specify the exact file that you want to mount from the config map. This way, you can avoid the read-only file system error, which occurs when you try to write to the directory that contains the config map files. For example, you can use the following code: