'Helm: creating a volume with original image files

I have an image, specifically Nginx, that I want to run with readOnlyRootFilesystem: true.

For this reason I started creating empty volumes (using volumes, emptyDir and then volumeMounts) for the places that a container would write to, like /etc/nginx. This way I can use readOnlyRootFilesystem with specific mounted writable folders.

However it seems there are some files in /etc/nginx, like /etc/nginx/template/nginx.tmpl, that are needed by the container.

How can I create the volumes in such a way that it contains the files present in the image? So that files like /etc/nginx/template/nginx.tmpl are present in the new volume but readOnlyRootFilesystem can still be used.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source