Injecting a ConfigMap into a container converts its data into files. Your application can then read these files, letting you modify its configuration without rebuilding the image.
Procedure
-
Expand the Configuration Management area and configure the settings as needed.
Configuration
Before injecting a configuration item, you must first create it. You can create a ConfigMap in the application's Namespace, or click Create Configuration Item (ConfigMap) in this section. ConfigMaps created in the Create ConfigMap panel are automatically synchronized to the application's Namespace.
Click + Add to inject a single key or all keys from a ConfigMap into the container as files. The value of each key becomes the content of its corresponding file, and you can specify a custom mount path.
To update the configuration, first copy the original configuration file content from the container to a local file. After making changes, save the updated content as the value of a configuration item (ConfigMap). Then, inject the ConfigMap into the container as described in this topic. You must then redeploy the application and click the refresh button next to the ConfigMap Name for the changes to take effect.
Single key
Select an existing ConfigMap Name and a Key, then enter the Mount Path. The Mount Path is the absolute path of the file in the container environment, including the file name. If the path does not exist, it is created automatically. If a file with the same name already exists at the path, it is overwritten. The injected file is read-only in the container.
For example, mount key key1 from configuration item cm1 to /etc/nginx/nginx.conf.
All keys
Select an existing ConfigMap Name, choose All from the Key drop-down list, and then enter the Mount Path. The Mount Path is the absolute path of a directory in the container environment. The path must not include a file name or end with a forward slash (/). Each injected file is named after its corresponding key. If the path does not exist, it is created automatically. If files with the same names already exist at the path, they are overwritten. The injected files are read-only in the container.
For example, mount all keys from configuration item cm1 to the /etc/nginx directory.