Injecting a Configuration from a Single File
Explore how to create a Kubernetes ConfigMap from a single file and mount it within a Pod to manage application configurations. Understand how ConfigMaps store file data, how they are linked inside containers, and verify content consistency. Practice creating, using, and deleting ConfigMaps for flexible configuration management.
Creating a ConfigMap
In its purest (and probably the most common) form, a ConfigMap takes a single file. For example, we can create one from the prometheus-conf.yml file.
We create a ConfigMap (cm) called my-config. The data of the map is the content of the prometheus-conf.yml file.
Looking into the description
Let’s describe it and see what we get.
The output is as follows:
The important part is located below Data. We can see the key which, in this case, is the name of the file (prometheus-conf.yml). Further down, we can see the contents of the file. ...