Applying configurations using ConfigMaps
In this section, we are going to learn how to use ConfigMap resources, mount files inside containers or as environment variables, and present the information for our application’s processes.
The content of a ConfigMap resource is stored in the Kubernetes etcd key-value store. Due to this, the content can’t exceed 1 MB in size. The manifest of these resources doesn’t have a spec
section. Instead, we can have either data
or binaryData
(for Base64 content) keys for defining the content. The following screenshot shows an example of a ConfigMap manifest:
Figure 10.1 – ConfigMap resource manifest
In the code in the presented screenshot, we have declared two types of configurations. While APP_VAR1
and APP_VAR2
are defined in key-value format, the appsettings
section defines a complete configuration file that can be mounted. Notice the pipe symbol (|
) used to define the appsettings
key. This...