<p>I've spent a good amount of time to figure out how to increase php configuration values for Wordpress in a Kubernetes environment so I thought somebody else might be interested.</p>

<p>My setup is as follows:</p>

<ul>
<li>Azure AKS (any other Kubernetes cluster would be much the same)</li>
<li>Kubeapps by Bitnami for managing helm charts (<a href="https://kubeapps.com/" rel="nofollow noreferrer">https://kubeapps.com/</a>)</li>
</ul>

<h2>Problem</h2>

<p>For some Wordpress plugins I need to increase the values for <code>post_max_size</code>, <code>max_execution_time</code>, <code>upload_max_filesize</code> and <code>max_input_time</code>.</p>

J J
<h2>Solution</h2>

<p>The only proper way to change the php values I found is by using a custom HTAccess file. To achieve that you first of all need to create a configMap. This configMap is separated from the Wordpress app and can be used for multiple instances of Wordpress running on your Kubernetes cluster. The following is an example of a working configMap. You should take care of the namespace you choose. <code>kubeapps</code> is the default namespace, if you have chosen a different one you should apply the same for your configMap otherwise the configMap might not be found.</p>

<pre><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: prod-wordpress-cm
  namespace: kubeapps
data:
  wordpress-htaccess.conf: |
    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 180
    php_value max_input_time 180
</code></pre>

<p>When you successfully applied the configMap to your cluster by running <code>kubectl apply -f prod-wordpress-cm.yaml</code> you can reference it in the Kubeapps helm chart <code>values.yaml</code> which holds your instance specific configuration (for details see: <a href="https://hub.kubeapps.com/charts/bitnami/wordpress" rel="nofollow noreferrer">https://hub.kubeapps.com/charts/bitnami/wordpress</a> and <a href="https://github.com/bitnami/bitnami-docker-wordpress" rel="nofollow noreferrer">https://github.com/bitnami/bitnami-docker-wordpress</a>). Ensure that you enter the same configMap name you have chosen above.</p>

<pre><code>## Set Apache allowOverride to None
## ref: https://github.com/bitnami/bitnami-docker-wordpress#environment-variables
##
allowOverrideNone: true

# ConfigMap with custom wordpress-htaccess.conf file (requires allowOverrideNone to true)
customHTAccessCM: prod-wordpress-cm
</code></pre>

<p>And you are done. Hope that helps saving some time for others.</p>
