ConfigMaps
ConfigMaps allow you to decouple configuration files from container images to enhance the portability of workloads.
ConfigMaps provide the following benefits:
- Manage configurations for different environments and services.
- Deploy workloads in different environments. Multiple versions are supported for configuration files so that you can update and roll back workloads easily.
- Quickly import configurations in the form of files to containers.
After a ConfigMap is created on the MCP console, a ConfigMap with the same name will be created in all clusters deployed on this MCP.
Creating a ConfigMap
- Log in to the MCP console. In the navigation pane, choose Resource Management > Configuration Center, and click Create ConfigMap under the ConfigMaps tab.
- Set the parameters listed in Table 1.
Table 1 Parameters for creating a ConfigMap Parameter
Description
Name
Name of a ConfigMap, which must be unique in a namespace.
Namespace
Namespace to which the ConfigMap belongs. If you do not specify this parameter, the value default is used by default.
Data
The workload configuration data can be used in a container or used to store the configuration data. Key specifies the file name, and Value specifies the file content.
- Click Add Data.
- Set Key and Value.
Label
Labels are attached to objects such as workloads, nodes, and Services in key-value pairs.
Labels define identified attributes of these objects and can be used to manage and select objects.
- Click Add Label.
- Set Key and Value.
Description
Description of the ConfigMap.
Cluster
Cluster that will use the ConfigMap you created.
- Click Create after the configuration is complete.
Using a ConfigMap
After the ConfigMap is created, you can mount the ConfigMap to a container during workload creation (for details, see Deployments). Then, you can read the ConfigMap data from the mount path of the container.
Related Operations
| Operation | Description |
|---|---|
| Viewing a YAML file | Click View YAML in the row where the target ConfigMap resides to view its YAML file. |
| Updating a ConfigMap |
|
| Deleting a ConfigMap |
|
| Viewing events | Select a ConfigMap and choose More > View Event in the Operation column to view the events of the ConfigMap. NOTE: Event data will be retained for 1 hour and then automatically deleted. |
Last Article: Configuration Center
Next Article: Secrets
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.