"Request entity too large: limit is 3145728" when trying to update a k8s CR resource

5/12/2020

We are hitting an error "Request entity too large: limit is 3145728" when trying to update a custom resource object. That would be very helpful if any one knows how to change the size limit from k8s side. Is there any exposed parameters for user?

-- yuany
kubernetes
kubernetes-custom-resources

1 Answer

5/20/2020

Source for this answer: https://stackoverflow.com/a/60492986/12153576

  • The "error": "Request entity too large: limit is 3145728" is probably the default response from kubernetes handler for objects larger than 3MB, as you can see here at L305 of the source code:
expectedMsgFor1MB := `etcdserver: request is too large`
expectedMsgFor2MB := `rpc error: code = ResourceExhausted desc = trying to send message larger than max`
expectedMsgFor3MB := `Request entity too large: limit is 3145728`
expectedMsgForLargeAnnotation := `metadata.annotations: Too long: must have at most 262144 bytes`
  • The ETCD has indeed a 1.5MB limit for processing a file and you will find on ETCD Documentation a suggestion to try the--max-request-bytes flag but it would have no effect on a GKE cluster because you don't have such permission on master node.

  • But even if you did, it would not be ideal because usually this error means that you are consuming the objects instead of referencing them which would degrade your performance.

I highly recommend that you consider instead these options:

  • Determine whether your object includes references that aren't used;
  • Break up your resource;
  • Consider a volume mount instead;

There's a request for a new API Resource: File (orBinaryData) that could apply to your case. It's very fresh but it's good to keep an eye on.

-- mWatney
Source: StackOverflow