且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Kubernetes ConfigMap 大小限制

更新时间:2023-01-08 23:10:20

没有硬限制 在撰写本文时在 ConfigMap 或 Secret 对象上.

There are no hard-limits on either the ConfigMap or Secret objects as of this writing.

但是,Kubernetes 存储的 etcd 端有 1MB 的限制它的对象.

There's, however, a 1MB limit from the etcd side which is where Kubernetes stores its objects.

从API方面,如果你真的看到了API code 和 ConfigMap 类型,你会看到它的 data 字段是 Golang 的字符串映射,因此这看起来是内存绑定并在运行时管理的,除非它在其他地方用 make() 定义.从技术上讲,hashmap 上键数的最大大小是映射长度,它是一个 int,最大值在这里解释:地图中元素的最大数量.这也将是数据值作为 len(string) 的最大值的理论限制.

From the API side, if you actually see the API code and the ConfigMap type, you'll see that its data field is Golang map of strings so this appears memory bound and managed at runtime unless somewhere else it gets defined with make(). Technically the max size for the number of keys on hashmap is the map length which is an int and the max value is explained here: Maximum number of elements in map. That would also be the theoretical limit for the value of data as the maximum value for len(string).

如果您真的想从 kube-apiserver 接收 protobufs(或 JSON)的 API 方面获得更多见解,您可以查看 google protobuf 最大尺寸.这将为您提供有关通过线路发送 data 字段的限制的一些措施.在处理任何大消息时,kube-apiserver 本身可能还有其他限制.

If you actually want to get more insights from the API side where the kube-apiserver receives protobufs (or JSON for that matter) you can take a look at the google protobuf maximum size. That will give you some measure as to the limitation of sending the data field through the wire. There may be other limitation from the kube-apiserver itself when it comes to processing any large message.