Configuring ConfigMap

Store configuration data in key-value pairs within a ConfigMap, including single attributes or entire configuration files. ConfigMaps can be referenced in workloads through environment variables, configuration references, and other means.

Note: A Pod can only use ConfigMaps within the same namespace.

Procedure

  1. Navigate to Container Platform.

  2. In the left sidebar, click Configuration > ConfigMap.

  3. Click Create ConfigMap.

  4. Refer to the instructions below to configure the relevant parameters.

    ParameterDescription
    EntriesRefers to key:value pairs, supporting both Add and Import methods.
    • Add: You can add configuration items one by one, or you can paste one or multiple lines of key=value pairs in the Key input area to bulk add configuration items.
    • Import: Import a text file not larger than 1M. The file name will be used as the key, and the file content will be used as the value, filled into a configuration item.
    Binary EntriesRefers to binary files not larger than 1M. The file name will be used as the key, and the file content will be used as the value, filled into a configuration item.
    Note: After creating a ConfigMap, the imported files cannot be modified.

    Example of Bulk Add Format:

    # One key=value pair per line, multiple pairs must be on separate lines, otherwise they will not be recognized correctly after pasting. key1=value1 key2=value2 key3=value3
  5. Click Create.

Operations

You can click the (⋮) on the right side of the list page or click Actions in the upper right corner of the detail page to update or delete the ConfigMap as needed.

Changes to the ConfigMap will affect the workloads that reference the configuration, so please read the operation instructions in advance.

OperationsDescription
Update
  • After adding or updating a ConfigMap, any workloads that have referenced this ConfigMap (or its configuration items) through environment variables need to rebuild their Pods for the new configuration to take effect.
  • For imported binary configuration items, only key updates are supported, not value updates.
DeleteAfter deleting a ConfigMap, workloads that have referenced this ConfigMap (or its configuration items) through environment variables may be adversely affected during Pod creation if they are rebuilt and cannot find the reference source.