<p>In the pre-k8s, pre-container world, I have a cloud VM that runs nginx and lets an authorized user scp new content into the webroot.</p>

<p>I'd like to build a similar setup in a k8s cluster to host static files, with the goal that:</p>

<ol>
<li>An authorized user can scp new files in</li>
<li>These files are statically served on the web</li>
<li>These files are kept in a persistent volume so they don't disappear when things restart</li>
</ol>

<p>I can't seem to figure out a viable combination of storage class + containers to make this work. I'd definitely appreciate any advice!</p>

<hr>

<h2>Update</h2>

<p>What I didn't realize is that two containers running in the same pod can both have the same <code>gcePersistentDisk</code> mounted as read/write. So my solution in the end looks like one nginx container running in the same pod as an sshd container that can write to the nginx webroot. It's been working great so far.</p>

<p>I think you're trying to fit a square peg into a round hole here.</p>

<p>Essentially, you're building an FTP server (albeit with scp rather than FTP). </p>

<p>Kubernetes is designed to orchestrate containers. </p>

<p>The two don't really overlap at all.</p>

<p>Now, if you're really intent on doing this, you could hack something together by creating a docker container running an ssh daemon, plus nginx running under supervisor. The layer you need to be concentrating on is getting your existing VM setup replicated in a docker container. You can then run it on Kubernetes and attach a persistent volume. </p>
