Remain pod directory files while mounting a "hostpath PV " to pod Remain pod directory files while mounting a "hostpath PV " to pod kubernetes kubernetes

Remain pod directory files while mounting a "hostpath PV " to pod


Is this data static (you build it into the image), or does it change (you want a volume to persist it)? What behavior do you want when this content changes?

The combination of options you're trying to specify here doesn't really make sense. Kubernetes doesn't do the thing Docker does where if you mount an empty volume into a container it's filled with matching content from the image. Even so, if you make a change and rebuild the image, neither plain Docker nor Kubernetes will modify the volume; it will still have the old content.

My intuition for a tree of HTML files and related assets is that it's probably more "like data" than "like code", and so I would use a plain nginx image, copy the tree into the directory you're mounting as a hostpath, and proceed that way. When this tree changes, you'd make the changes in the hostpath directory.