Kubernetes ConfigMap size limitation
Asked Answered
R

3

28

Though resourceQuotas may limit the number of configmaps in a namespace, is there any such option to limit the size of the individual configmap? I will not like some user to start uploading large text files as configmaps.

What is the max size of ConfigMap etcd support? If there is a reasonable limit on the etcd side, should be fine then.

Ronrona answered 26/10, 2018 at 16:23 Comment(0)
H
38

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

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

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).

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.

Hylotheism answered 26/10, 2018 at 20:15 Comment(4)
Reading this: github.com/helm/helm/issues/1413 suggests there's a limit of 1mbOhara
Yeah, there's a 1MB limitation from the etcd side, added more details. Thx!Hylotheism
thanks , 1 MB limit seems pretty reasonbale , i am thinking of some custom addmission controller to reject a config map request of size larger than XRonrona
@IjazAhmadKhan no need to as at least from kubectl 1.18, you get an error if cm is larger than 1 MBCyme
F
6

The size of the individual configmap is limited to 1mb, according to kubernetes.io:

A ConfigMap is not designed to hold large chunks of data. The data stored in a ConfigMap cannot exceed 1 MiB. If you need to store settings that are larger than this limit, you may want to consider mounting a volume or use a separate database or file service.

The quote is taken from here - https://kubernetes.io/docs/concepts/configuration/configmap/#motivation

Feeley answered 20/4, 2021 at 9:47 Comment(0)
I
-2

Till date config maps come under object count quota. You can enforce a maximum on number of configmaps. You cant put limits on size of individual config map. As they are not yet included under Storage Resource Quota.

https://kubernetes.io/docs/concepts/policy/resource-quotas/

Inelegance answered 26/10, 2018 at 18:17 Comment(4)
I believe his question is about the limit on the ConfigMap size itself not on the number of ConfigMaps you can have on a clusterHylotheism
yes @Hylotheism i have mentioned you cant put limits on size of a configmap. I will edit it if it is not clear.Inelegance
Thanks , for the size limit I can do maybe custom admission controller for configmapRonrona
Cool.Let us know how you do it.Inelegance

© 2022 - 2024 — McMap. All rights reserved.