Why do comments in the yaml for Kubernetes ConfigMap count towards the unofficial 1 MB size limit?

11/4/2019

Looking at Kubernetes ConfigMap size limitation and https://github.com/kubernetes/kubernetes/issues/19781, the size limit for ConfigMap resources in Kubernetes seems to be 1 MB due to etcd restrictions. However, why do comments in the YAML for one's ConfigMap resources count towards the size and the 1 MB limit?

By comments, I mean the following in a sample ConfigMap yaml file:

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: my-configmap
  namespace: default
data:
  # Comment lines here that do not impact the ConfigMap in terms of actual value
  # or the resource but seem to count towards the 1 MB size limit
  key: val
-- RochesterinNYC
configmap
etcd
kubernetes

1 Answer

11/5/2019

1MB limit is not a limit for your data, but the limit for whole ConfigMap object that is stored in etcd.

-- HelloWorld
Source: StackOverflow