<p>I am trying to run a Factorio game server on Kubernetes (hosted on GKE).</p>

<p>I have setup a Stateful Set with a Persistent Volume Claim and mounted it in the game server's save directory.  </p>

<p>I would like to upload a save file from my local computer to this Persistent Volume Claim so I can access the save on the game server.  </p>

<p>What would be the best way to upload a file to this Persistent Volume Claim?</p>

<p>I have thought of 2 ways but I'm not sure which is best or if either are a good idea:</p>

<ul>
<li>Restore a disk snapshot with the files I want to the GCP disk which backs this Persistent Volume Claim</li>
<li>Mount the Persistent Volume Claim on an FTP container, FTP the files up, and then mount it on the game container</li>
</ul>

<p>It turns out there is a much simpler way: The <code>kubectl cp</code> command.  </p>

<p>This command lets you copy data from your computer to a container running on your cluster.  </p>

<p>In my case I ran:</p>

<pre><code>kubectl cp ~/.factorio/saves/k8s-test.zip factorio/factorio-0:/factorio/saves/
</code></pre>

<p>This copied the <code>k8s-test.zip</code> file on my computer to <code>/factorio/saves/k8s-test.zip</code> in a container running on my cluster.</p>

<p>See <code>kubectl cp -h</code> for more more detail usage information and examples.</p>
