Many applications require configuration using some combination of configuration files, command line arguments, and environment variables. In OKD, these configuration artifacts are decoupled from image content in order to keep containerized applications portable.
The ConfigMap object provides mechanisms to inject containers with configuration data while keeping containers agnostic of OKD. A ConfigMap can be used to store fine-grained information like individual properties or coarse-grained information like entire configuration files or JSON blobs.
The ConfigMap API object holds key-value pairs of configuration data that can be consumed in Pods or used to store configuration data for system components such as controllers. For example:
ConfigMap Object Definition
bar: L3Jvb3QvMTAw (2)
||Contains the configuration data.
||Points to a file that contains non-UTF8 data, for example, a binary Java keystore file. Enter the file data in Base 64.
You can use the
binaryData field when you create a ConfigMap from a binary file, such as an image.
Configuration data can be consumed in Pods in a variety of ways. A ConfigMap can be used to:
Populate environment variable values in containers
Set command-line arguments in a container
Populate configuration files in a volume
Users and system components can store configuration data in a ConfigMap.
A ConfigMap is similar to a secret, but designed to more conveniently support working with strings that do not contain sensitive information.
A ConfigMap must be created before its contents can be consumed in Pods.
Controllers can be written to tolerate missing configuration data. Consult individual components configured by using ConfigMaps on a case-by-case basis.
ConfigMap objects reside in a project.
They can only be referenced by Pods in the same project.
The Kubelet only supports the use of a ConfigMap for Pods it gets from the API server.
This includes any Pods created by using the CLI, or indirectly from a replication controller. It does not include Pods created by using the OKD node’s
--manifest-url flag, its
--config flag, or its REST API because these are not common ways to create Pods.