<p>Wordpress has been written as stateful application.
However, when it comes to container strategy, some hacking is needed.</p>

<p>In particular, I was thinking about a storage configuration as follows:</p>

<ul>
<li>a Persistent Volume Claim (PVC) for the content serving: mount <code>/var/www/html/wp-content/</code></li>
<li>another PVC for the WP-Admin: mount <code>/var/www/html/wp-admin/</code></li>
<li>an NFS-based (Google Filestore) PVC for the user uploads: mount <code>/var/www/html/wp-content/uploads</code></li>
</ul>

<p>The k8s manifest should look like:</p>

<pre><code>volumeMounts:
  - name: admin
    mountPath: /var/www/html/wp-admin/
  - name: content
    mountPath: /var/www/html/
  - name: uploads
    mountPath: /var/www/html/wp-content/uploads/
</code></pre>

<p>Since I never tried this setup, does it make sense?
Do you have any additional suggestions to take into account in having an ideal Wordpress deployment on Kubernetes?</p>

<p><strong>Separation strategy:</strong></p>

<p>Furthermore, are there well-known strategy to separate the WP-Admin in a completely separated container?</p>

<p>WordPress was not designed for containers. Your strategy will break quickly. </p>

<p>Set up an NFS server in a container to store the entire configuration and files for Apache, PHP, Let's Encrypt, WordPress and logging. </p>

<p>Don't forget to create a separate instance for MySQL. </p>

<p>Basically, you want everything related to this WordPress instance stored on NFS file shares. You will want to hand install everything so that you know exactly where the files are being stored. </p>

<p>When you are finished you will have a container that only mounts NFS shares and launches services. The data/files for the services is on NFS shares. </p>

<p>MySQL provides the database. I recommend Cloud SQL to improve reliability and split the most critical service away from Kubernetes because backups and snapshots are much easier to create and schedule.</p>

<blockquote>
  <p>Furthermore, are there well-known strategy to separate the WP-Admin in
  a completely separated container?</p>
</blockquote>

<p>Do not attempt that. You want the root and all subfolders of your WordPress website stored as an NFS share. Do not try to split the directories apart.</p>

<blockquote>
  <p>an NFS-based (Google Filestore) PVC for the user uploads: mount
  /var/www/html/wp-content/uploads</p>
</blockquote>

<p>Make sure you double-check pricing. This is an expensive solution for storing WordPress. I recommend creating an NFS container connected to a persistent volume and using NFS to carve out the data. This does bring up a single point of failure for NFS. Depending on how reliable you want the setup to be, Filestore may be the correct solution. Otherwise, you can also look at Active/Passive NFS or even NFS clustering on multiple containers.</p>
