What is a ConfigMap in Kubernetes?

Question
What is a ConfigMap in Kubernetes?

Answer
A ConfigMap is a mapping of configuration in YAML format. A .yaml file will define the version of the Kubernetes API (e.g., version 1), data, and the "kind:" key will be set to "ConfigMap".

The content of the ConfigMap is consumed by an application in Kubernetes. The values in the ConfigMap are "passed to containers as either environment variables or as files in a volume" (page 198 Kubernetes in Action by Luksa).

A deployment .yaml file may refer to a ConfigMap (page 198 Kubernetes in Action by Luksa).

You can create a ConfigMap with a text editor or with two successive commands like these:
kubectl create -f foobar.conf
kubectl create configmap foobar --from-file=foobar.conf

For detailed analysis, you may want to by Kubernetes in Action by Luksa and read page 200. The index for the book shows there are many pages that refer to the "ConfigMap" concept.

Leave a comment

Your email address will not be published. Required fields are marked *