I am trying to mount a shared read/write file in my Kubernetes pods. This file has to be identical in all pods. However, in the same directory I need to have a read-only file that is different for each pod. This is why I can't mount a PVC in the directory and call it a day.
Any idea how I can put a sharable read/write file in the same directory as all other pods, but have another file in that directory that's different per pod?
This idea in simple terms is a read/write configmap which I am aware is non-existent. Any ideas for a workaround?
The file that needs to be identical in all the pods I would put in a file storage like s3 amazon, dynamoDB or elasticCache. Depending if the file is a text or not.
The specific file I would store locally. Do you need to persist it if the pod dies?
You can consider using symlinks in the folder that contains the read-only and writable file. Have the symlinks point to well-known locations for the read-only and writable file respectively. Mount the PVC and configmap to the symlink targets and that should give you the desired behaviour.
Hope this helps!