ConfigMaps

    • Set the value of environment variables.
    • Set command parameters in containers.
    • Create a configuration file in volumes.

    This tutorial demonstrates how to create a ConfigMap in KubeSphere.

    You need to create a workspace, a project and a user (project-regular). The user must be invited to the project with the role of . For more information, see Create Workspaces, Projects, Users and Roles.

    1. Log in to the console as project-regular. Go to Configuration of a project, select ConfigMaps and click Create.

    2. On the Data Settings tab, configure values by clicking Add Data.

    3. Enter a key-value pair. For example:

      Note

      • key-value pairs displays under the field data in the manifest.

      • On the KubeSphere dashboard, you can only add key-value pairs for a ConfigMap currently. In future releases, you will be able to add a path to a directory containing configuration files to create ConfigMaps directly on the dashboard.

    4. Click Create to generate the ConfigMap.

    1. After a ConfigMap is created, it is displayed on the ConfigMaps page. You can click on the right and select the operation below from the drop-down list.

      • Edit Information: View and edit the basic information.
      • Edit Settings: Modify the key-value pair of the ConfigMap.
      • Delete: Delete the ConfigMap.
    2. Click the name of the ConfigMap to go to its details page. Under the tab Data, you can see all the key-value pairs you have added for the ConfigMap.

    3. Click More to display what operations about this ConfigMap you can do.

      • Edit YAML: View, upload, download, or update the YAML file.
      • Edit Settings: Modify the key-value pair of the ConfigMap.
      • Delete: Delete the ConfigMap, and return to the list page.
    4. Click Edit Information to view and edit the basic information.

    When you create workloads, , Jobs or , you may need to add environment variables for containers. On the Add Container page, check Environment Variables and click Use ConfigMap or Secret to use a ConfigMap from the list.