413 Errors with a Nginx Ingress

To begin with let me explain that I run a Kubernetes cluster using Digital Ocean’s Managed Kubernetes offering. So far I am very pleased with it. Very easy to set up and is more economical than offerings from other cloud providers.   At some point in the not too distant future I plan to add a post about how to go about that along with some hints covering what I’ve done slightly different from the norm.

I started migrating all of my blogs from my own Docker cloud engine which I plan to retire soon once I migrate everything over.  One of those blogs is my cooking blog and once I did that I managed to run into an unexpected snag.

As I started uploading images to it I ran into a screen that informed me the upload was too large along with a “413” error from nginx itself. What to do?

I spent the better part of two hours researching this issue and decided to open a ticket with Digital Ocean to see if they had come across this issue and went to bed. Next morning I had a reply that referred me to an article that I had read already.  Slowly the light bulb turned on in my brain.  The solutions I found before all depended on how the Nginx ingress controller was deployed to the Kubernetes cluster.

Stepping back a bit

When I set up the Nginx ingress controller I did it with Helm/Tiller using one of their charts.  Worked so far but the default settings were the issue.  Knowing this I made a discovery.  If I modified each of the ingress YAML files for the individual blogs I could solve the issue.  Here is the ingress configuration for https://cowdawgkitchens.com:


apiVersion: extensions/v1beta1
kind: Ingress
  name: cowdawg-kitchens-ingress
    kubernetes.io/ingress.class: nginx
    certmanager.k8s.io/cluster-issuer: cowdawg-kitchens-issuer
    external-dns.alpha.kubernetes.io/hostname: cowdawgkitchens.com
    nginx.ingress.kubernetes.io/proxy-body-size: "50m"
    - hosts:
      - cowdawgkitchens.com
      secretName: cowdawg-kitchens-issuer
  - host: cowdawgkitchens.com
      - backend:
          serviceName: cowdawg-kitchens
          servicePort: 80

Let me call your attention to the line “nginx.ingress.kubernetes.io/proxy-body-size: “50m””

That’s the line you need with the ingress loaded by Helm/Tiller.  Seems to be working fine now.


Copyright Devops — In the Trenches 2019
Tech Nerd theme designed by Siteturner