So I know this is possible and using ConfigMaps this way comes with auto update capability, which is great.
But when consuming such ConfigMap in a pod, what's exactly happening? Do we read these as actual files from disk? Or are these files stored in some sort of in-memory fs / ETCD?
My code would read these "files" on each req, but if this means actual disk operations, that's not good. So how does this work and how fast this is?
But when consuming such ConfigMap in a pod, what's exactly happening? Do we read these as actual files from disk? Or are these files stored in some sort of in-memory fs / ETCD?
ConfigMaps are stored in ETCD data-store
My code would read these "files" on each req, but if this means actual disk operations, that's not good. So how does this work and how fast this is?
Depends on how are you consuming the ConfigMap
s. You can either inject a specific key/value pair as environment variable in your Pods
and mount them as volumes.
In case of mounting, ConfigMap
s are placed as files in Pods' ephemeral storage. They are placed only once, at the start of Pod's life-cycle.
Application running inside the Pod would be reading the data directly from the file inside against every request.
IMO, performance penalties in terms of reading won't that big since ETCD pods/daemon services reside in the same k8s cluster along with rest of the services. However, if your ETCD is part of some other external node, you may face network level latency.
Check out this link for further reading