Updated on 2025-08-12 GMT+08:00

ConfigMaps

ConfigMaps are objects that you can use to store the configurations required by applications. After you create a ConfigMap, you can use it as a file in a containerized application.

Creating a ConfigMap

  1. Log in to the CCI 2.0 console.
  2. In the navigation pane, choose Configuration Center.
  3. Select a namespace and click the ConfigMaps tab.
  4. Click Create from YAML in the upper left corner and edit the YAML file. For details about the YAML file, see YAML format.

    CCI 2.0 supports both JSON and YAML, and the file size cannot exceed 1 MiB.

  5. Click OK.

Using a ConfigMap

After a ConfigMap is created, you can mount it to a container as a storage volume during pod creation. For example, mount a ConfigMap named system-preset-aeskey to a container and set the storage volume name to volume1.

Figure 1 ConfigMaps

ConfigMap File Format

A ConfigMap resource file must be in either JSON or YAML format, and the file size cannot exceed 1 MiB.

  • YAML format
    Example file: configmap.yaml
    apiVersion: cci/v2
    kind: ConfigMap
    metadata:
      name: configmap-example
    data:
      key1: value1
      key2: value2
  • JSON format

    Example file: configmap.json

    {
    	"apiVersion": "cci/v2",
    	"kind": "ConfigMap",
    	"metadata": {
    		"name": "configmap-example"
    	},
    	"data": {
    		"key1": "value1",
    		"key2": "value2"
    	}
    }