One more of those small things that can cost you hours to find again when you eventually need it. 

502 – too big header

If you get nginx 502 error pages when browsing one of the services you deployed to a kubernetes controller using a nginx ingress controller to expose it, you may need to change the nginx configuration.

Check the logs for the ingress controller pod and look for the request that failed. 

If you find something like this:

...upstream sent too big header while reading response header from upstream, client: ...

You will want to change the nginx configuration to enable proxy buffering (disabled by default).

You can do this by change the config map for the nginx ingress controller or by adding annotations to a specific ingress:


kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/proxy-buffering: "on"

The default buffer size is “4k”, you can also change it by adding another annotation:

nginx.ingress.kubernetes.io/proxy-buffer-size: 16k

413 – Body Size

Another common issue is getting a 413 when requests have a large body

You can fix that by changing the max body size:

nginx.ingress.kubernetes.io/proxy-body-size: 8m

400 – Bad request

request header or cookie too large

You have to change the configmap ingress-nginx-controller and restart the controller.

Add to the data section large_client_header_buffers

data:
    # ...
    large_client_header_buffers 4 16k;

https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#large-client-header-buffers

References


0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *