Kubernetes 对象大小限制 [英] Kubernetes object size limitations

查看:62
本文介绍了Kubernetes 对象大小限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理 CRD 并创建自定义资源.我需要在自定义资源中保留有关我的应用程序的大量信息.根据官方文档,etcd 最多可处理 1.5MB 的请求.我遇到了诸如

I am dealing with CRDs and creating Custom resources. I need to keep lots of information about my application in the Custom resource. As per the official doc, etcd works with request up to 1.5MB. I am hitting errors something like

错误":请求实体太大:限制为 3145728"

"error": "Request entity too large: limit is 3145728"

我相信错误中指定的限制是 3MB.对此有何想法?这个问题有什么出路吗?

I believe the specified limit in the error is 3MB. Any thoughts around this? Any way out for this problem?

推荐答案

  • "error": "Request entity too large: limit is 3145728" 可能是 kubernetes 处理程序对大于 3MB 的对象的默认响应,如您所见 这里是L305的源代码:

    • 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`
      

      • ETCD 确实有 1.5MB 的限制来处理一个文件,你会在 ETCD 文档 建议尝试使用--max-request-bytes 标志,但它不会对 GKE 集群产生影响,因为您在主节点上没有此类权限.

        • 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:

          • 确定您的对象是否包含未使用的引用;
          • 分解你的资源;
          • 考虑安装卷;

          有一个新 API 资源:文件 (orBinaryData) 的请求,可以申请你的情况.很新鲜,但值得关注.

          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.

          如果您仍然需要帮助,请告诉我.

          If you still need help let me know.

          这篇关于Kubernetes 对象大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆