You can use ConfigMaps to store configurations that do not need to be kept confidential, such as the Java virtual machine (JVM) heap memory, JVM properties, and Java agent. This topic describes how to manage ConfigMaps.

Prerequisites

  • A Kubernetes cluster is created in the Container Service for Kubernetes (ACK) console.
    • To use an ACK cluster in Enterprise Distributed Application Service (EDAS), create a managed Kubernetes cluster or a dedicated Kubernetes cluster in the Container Service for Kubernetes (ACK) console. For more information, see the following topics:
    • To use a serverless Kubernetes cluster in EDAS, create a serverless Kubernetes cluster in the Container Service for Kubernetes (ACK) console. For more information, see Create an ASK cluster.
  • The created Kubernetes cluster is imported to EDAS. For more information, see Import a Kubernetes cluster to the EDAS console.

Background information

You can use ConfigMaps to store configurations that do not need to be kept confidential. ConfigMaps can be passed to containers when you create or deploy applications. If you modify a ConfigMap, the modification takes effect after you redeploy the relevant application.

You can use ConfigMaps in the following two scenarios:

For more information, see Configure a Pod to Use a ConfigMap.

Create a ConfigMap

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Configuration Management > Kubernetes Configurations.
  3. In the left-side pane of the Kubernetes Configurations page, click Configuration Items.
  4. On the Configuration Items page, select a region in the top navigation bar. Then, select a Microservice Namespaces .
    Note Make sure that your Kubernetes cluster is imported to the specified Microservice Namespaces . Otherwise, the system returns a message to remind you that the cluster does not exist.
  5. On the Configuration Items page, click Create configuration item.
  6. In the Create configuration item panel, set the parameters as required and click Yes.
    Create a ConfigMap
    Parameter Description
    Name The name of the ConfigMap. The name can contain lowercase letters, hyphens (-), and digits. It must start with a letter and cannot end with a hyphen (-).
    Cluster Name The Kubernetes cluster for which you want to create the ConfigMap. Select the required Kubernetes cluster from the drop-down list.
    k8sNameSpace The Kubernetes namespace of the cluster. Internal system objects are allocated to different Kubernetes namespaces to form logically isolated projects, groups, or user groups. This way, different groups can be separately managed and can also share the resources of the entire cluster. Valid values:
    • default: the default Kubernetes namespace. If no Kubernetes namespace is specified for an object, the default Kubernetes namespace is used.
    • kube-system: the Kubernetes namespace of the objects that are created by the system.
    • kube-public: the Kubernetes namespace that is automatically created by the system. This Kubernetes namespace can be read by all the users, including the users who are not authenticated.

    In this example, default is selected.

    Configuration mapping
    Note Multiple key-value pairs are supported in a single ConfigMap. To create a key-value pair, click Add.
    Key The key of the configuration item. The key can contain letters, digits, underscores (_), hyphens (-), and periods (.).
    Value The value of the configuration item.

View a ConfigMap

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Configuration Management > Kubernetes Configurations.
  3. In the left-side pane of the Kubernetes Configurations page, click Configuration Items.
  4. On the Configuration Items page, select a region in the top navigation bar. Then, select a Microservice Namespaces .
  5. On the Configuration Items page, find the ConfigMap that you want to view and click Details.
    You can search for the required ConfigMap by setting the ConfigName, Cluster, Cluster Id, and k8sNamespace parameters.
  6. On the details page of the ConfigMap, view the basic information about the ConfigMap and the key-value pairs in the ConfigMap.

Modify a ConfigMap

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Configuration Management > Kubernetes Configurations.
  3. In the left-side pane of the Kubernetes Configurations page, click Configuration Items.
  4. On the Configuration Items page, select a region in the top navigation bar. Then, select a Microservice Namespaces .
  5. On the Configuration Items page, find the ConfigMap that you want to modify and click Edit.
    You can search for the required ConfigMap by setting the ConfigName, Cluster, Cluster Id, and k8sNamespace parameters.
  6. In the editing panel, modify the keys and values in the ConfigMap based on your requirements and click Yes.
    Note If the ConfigMap is used by an application, redeploy the application after you modify the ConfigMap. Otherwise, the updated configurations do not take effect in the application.

Delete a ConfigMap

  1. Log on to the EDAS console.
  2. In the left-side navigation pane, choose Configuration Management > Kubernetes Configurations.
  3. In the left-side pane of the Kubernetes Configurations page, click Configuration Items.
  4. On the Configuration Items page, select a region in the top navigation bar. Then, select a Microservice Namespaces .
  5. On the Configuration Items page, find the ConfigMap that you want to delete and click Delete.
    You can search for the required ConfigMap by setting the ConfigName, Cluster, Cluster Id, and k8sNamespace parameters.
  6. In the message that appears, click Yes.
    Note We recommend that you do not delete a ConfigMap if it is used by an application. If you delete a ConfigMap that is used by an application, the application cannot properly run after you restart or redeploy the application.