Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

POST larger than 400 Kilobytes payload to a container in Kubernetes fails

I'm using EKS (Kubernetes) in AWS and I have problems with posting a payload at around 400 Kilobytes to any web server that runs in a container in that Kubernetes. I hit some kind of limit but it's not a limit in size, it seems at around 400 Kilobytes many times works but sometimes I get (testing with Python requests)

requests.exceptions.ChunkedEncodingError: ("Connection broken: ConnectionResetError(104, 'Connection reset by peer')", ConnectionResetError(104, 'Connection reset by peer'))

I test this with different containers (python web server on Alpine, Tomcat server on CentOS, nginx, etc).

The more I increase the size over 400 Kilobytes, the more consistent I get: Connection reset by peer.

Any ideas?

like image 716
StefanH Avatar asked Apr 03 '19 19:04

StefanH


People also ask

How big can a Kubernetes pod be?

With the default maximum of 110 Pods per node, Kubernetes assigns a /24 CIDR block (256 addresses) to each of the nodes.

What is the maximum number of containers a pod can have?

No more than 5000 nodes. No more than 150000 total pods. No more than 300000 total containers.

How do I check if a Kubernetes pod is failing?

You can see them by simply putting --previous flag along with your kubectl logs ... cmd.

How much RAM do I need for Kubernetes?

Each node in your cluster must have at least 300 MiB of memory.


2 Answers

Thanks for your answers and comments, helped me get closer to the source of the problem. I did upgrade the AWS cluster from 1.11 to 1.12 and that cleared this error when accessing from service to service within Kubernetes. However, the error still persisted when accessing from outside the Kubernetes cluster using a public dns, thus the load balancer. So after testing some more I found out that now the problem lies in the ALB or the ALB controller for Kubernetes: https://kubernetes-sigs.github.io/aws-alb-ingress-controller/ So I switched back to a Kubernetes service that generates an older-generation ELB and the problem was fixed. The ELB is not ideal, but it's a good work-around for the moment, until the ALB controller gets fixed or I have the right button to press to fix it.

like image 94
StefanH Avatar answered Oct 19 '22 23:10

StefanH


As you mentioned in this answer that the issue might be caused by ALB or the ALB controller for Kubernetes: https://kubernetes-sigs.github.io/aws-alb-ingress-controller/.

Can you check if Nginx Ingress controller can be used with ALB ?

Nginx has a default value of request size set to 1Mb. It can be changed by using this annotation: nginx.ingress.kubernetes.io/proxy-body-size.

Also are you configuring connection-keep-alive or connection timeouts anywhere ?

like image 1
Ankit Deshpande Avatar answered Oct 20 '22 00:10

Ankit Deshpande