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 to keep containerized applications portable.
ConfigMap object provides mechanisms to inject containers with configuration data while keeping containers agnostic of OKD. A config map can be used to store fine-grained information like individual properties or coarse-grained information like entire configuration files or JSON blobs.
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 config map from a binary file, such as an image.
Configuration data can be consumed in pods in a variety of ways. A config map 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 config map.
A config map is similar to a secret, but designed to more conveniently support working with strings that do not contain sensitive information.
Config map restrictions
A config map 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 config maps 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 config map 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.