Kubernetes ConfigMap size limitation

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


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.