Kubernetes 101 : ConfigMaps - decoupling variables from images -

The configMaps are a kubernetes object that stores data in a "key, value" format, separate from the application running inside the pods.

It gives us the flexibility of having replicas of the same application tied to different configMaps, instead of having to build different images with the variables built into them.

We could create a simple configMap using the below command:

If we have multiple variable, we could place them in a file, and mention the path to them in the below command:

A configMap with the name "config-1" is created.

We could list our configMaps using the below command:

If we have two configMaps for example in our "/path/to/config" directory, we could create the configMap in the same way as above, mentioning only the directory:

We would have the below results:

To have a detailed look at the configuration of our configMap  we use the below command:

The output is written to the file "configMap.yaml".


ConfigMaps are used to store non-sensitive information. 
There is another kubernetes object that can hold passwords, keys, ..., called Secret.

Below a simple example of a configMap with two variables:


Leave as a comment: