Manage ConfigMaps

更新时间:
复制 MD 格式

A ConfigMap is a resource type that stores configuration information for workloads. You can customize the content of a ConfigMap.

Create a ConfigMap

You can create federated ConfigMaps or ConfigMaps for individual clusters.

Create a federated ConfigMap

  1. Log on to the LHC console. In the navigation pane on the left, click Configuration Management > ConfigMaps.

  2. Click Create. On the Create ConfigMap page, enter the following information:

    • Namespace: Select a namespace.

    • Name: Enter a name for the ConfigMap. The name must be unique within the namespace, up to 32 characters in length, and can contain lowercase letters, digits, and hyphens (-). It must start with a letter and end with a letter or a digit.

    • Configuration Source: Add key-value pairs. The key is the variable name and the value is the configuration data.

    • Custom Configuration: This option is disabled by default. You can enable it to customize the ConfigMap at the deployment unit level.

  3. After you complete the configuration, click Create.

Create a single-cluster ConfigMap

  1. Log on to the LHC console. In the navigation pane on the left, click Cluster Management > Clusters > Details to open the cluster list page.

  2. Click the name of a cluster to open the Cluster Details page, and then click the Configuration tab.

  3. In the navigation pane on the left, select ConfigMaps.

  4. (Optional) Select a namespace. If you do not select one, the default namespace is used.

  5. Click Create. On the Create ConfigMap page, enter the following information:

    • Namespace: The namespace to which the ConfigMap belongs. This is based on your selection in the previous step. The default value is default.

    • Name: Enter a name for the ConfigMap. The name must be unique within the namespace, up to 32 characters in length, and can contain lowercase letters, digits, and hyphens (-). It must start with a letter and end with a letter or a digit.

    • Configuration Source:

      • Key-Value Pair: Add key-value pairs. The key is the variable name and the value is the configuration data.

      • File: Upload a file to create the ConfigMap.

  6. After you complete the configuration, click Submit.

Modify configuration items

Changes to a ConfigMap affect the applications that use it.

  1. On the ConfigMaps list page, click the Name of a ConfigMap to open its details page.

  2. You can make the following changes:

    • Click Edit to modify existing ConfigMap data, and then click Submit.

    • Click Add to add a key-value pair, and then click Submit.