<p>I am hosting a Ghost blog using Kubernetes and the docker image ghost with version 3.16.1. While uploading a theme, I get a error message that the file size is to large.</p>
<blockquote>
<p>The file you uploaded was larger than the maximum file size your server allows.</p>
</blockquote>
<p>I have been remoting into the pod to see if I found any settings there that I could configure without see any. Can not see what configuration to add in the deployment file to increase the default.</p>
<p>I have a Ingress controller that is using Nginx and is specifying &quot;nginx.org/client-max-body-size&quot;, but that did not help after I added that one.</p>
<p>Do anyone know how I can increase the maximum file size while using the Ghost docker image and nginx ingress controller? Below is part of the ingress conroller configuation file and the deployment file.</p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: beitostolenlive-no-ingress
  namespace: beitostolenlive-no
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    cert-manager.io/cluster-issuer: &quot;letsencrypt-prod&quot;
    nginx.org/proxy-connect-timeout: &quot;30s&quot;
    nginx.org/proxy-read-timeout: &quot;20s&quot;
    nginx.org/client-max-body-size: &quot;50m&quot;
</code></pre>
<p>Here is the deployment configuration file.</p>
<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
    name: beitostolenlive-no
    namespace: beitostolenlive-no
    labels:
        web: beitostolenlive-no
spec:
    replicas: 1
    strategy:
        type: Recreate
    selector:
        matchLabels:
            web: beitostolenlive-no
    template:
        metadata:
            labels:
                web: beitostolenlive-no
        spec:
            containers:
            - name: beitostolenlive-no
              image: ghost:3.16.1
              imagePullPolicy: Always
              ports:
                - containerPort: 2368
              env:
                - name: url
                  value: https://beitostolenlive.no
                - name: database__client
                  value: mysql
                - name: database__connection__host
                  value: ***
                - name: database__connection__user
                  value: ***
                - name: database__connection__password
                  value: ***
                - name: database__connection__database
                  value: ***
              volumeMounts:
              - mountPath: /var/lib/ghost/content
                name: content
            volumes:
            - name: content
              persistentVolumeClaim:
                claimName: beitostolenlive-no-content
</code></pre>

<p>Please add <code>nginx.ingress.kubernetes.io/proxy-body-size</code> annotation to your ingress configuration file.</p>
<p>For NGINX, an such error will be returned to the client when the size in a request exceeds the maximum allowed size of the client request body. This size can be configured by the parameter  <a href="http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size" rel="nofollow noreferrer"><code>client_max_body_size</code></a>.</p>
<p>To configure this setting globally for all Ingress rules, the  <code>proxy-body-size</code>  value may be set in the  <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/configmap.md#proxy-body-size" rel="nofollow noreferrer">NGINX ConfigMap</a>. To use custom values in an Ingress rule define annotation I have mentioned.</p>
<p>Useful information: <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md#custom-max-body-size" rel="nofollow noreferrer">custom-max-body-size</a>, <a href="https://jessicadeen.com/error413-k8s-helm/" rel="nofollow noreferrer">413-k8s-helm</a>.</p>
