mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
// Module included in the following assemblies:
|
|
//
|
|
// * builds/setting-up-trusted-ca
|
|
|
|
[id="configmap-overview_{context}"]
|
|
= Understanding ConfigMaps
|
|
|
|
Many applications require configuration using some combination of configuration
|
|
files, command line arguments, and environment variables. 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 {product-title}. 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. ConfigMap is similar to secrets, but
|
|
designed to more conveniently support working with strings that do not contain
|
|
sensitive information. For example:
|
|
|
|
.ConfigMap Object Definition
|
|
[source,yaml]
|
|
----
|
|
kind: ConfigMap
|
|
apiVersion: v1
|
|
metadata:
|
|
creationTimestamp: 2016-02-18T19:14:38Z
|
|
name: example-config
|
|
namespace: default
|
|
data: <1>
|
|
example.property.1: hello
|
|
example.property.2: world
|
|
example.property.file: |-
|
|
property.1=value-1
|
|
property.2=value-2
|
|
property.3=value-3
|
|
binaryData:
|
|
bar: L3Jvb3QvMTAw <2>
|
|
----
|
|
<1> Contains the configuration data.
|
|
<2> Points to a file that contains non-UTF8 data, for example, a binary Java keystore file.
|
|
Enter the file data in Base 64.
|
|
|
|
[NOTE]
|
|
====
|
|
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:
|
|
|
|
1. Populate the value of environment variables.
|
|
2. Set command-line arguments in a container.
|
|
3. Populate configuration files in a volume.
|
|
|
|
Both users and system components can store configuration data in a
|
|
ConfigMap.
|