Kubernetes has a bit of a steep learning curve but can elevate your devops skillset to do more with less. What used to take a team of devops engineers now can be achieved by a single individual. Kubernetes works well when it, well, works.
It does not always work.
While setting up a blog for a client, I needed to upload a series of JPEG images that were larger than 1MB in size. Testing my website locally, everyting worked as expected when I would upload a 2MB image file. But I would receive an error when pusing the website to production.
The error message I received in the admin interface was an unhelpful An error has occurred
. After some experiementing I discovered:
After a little (and quite embarrasing) bit of time, I determine that the POST request to upload the image file return an HTTP status code of 413 which is a "Payload Too Large" error. More information can be found on MDN web docs here.
In the response, I determine that the message was returned by nginx which was the type of ingress used in the Kubernetes cluster hosting the blog. After a very quick bit of googling, I determined that this was a quick fix by annotating the Ingress to increase the body size of the request.
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: customerblog
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/proxy-body-size: "30m"
After implementing the above annotation and applying to the Kubernetes cluster, I was able to successfully upload images larger than 1MB.