Skip to content

Create ConfigMaps

ConfigMaps store non-confidential data in the form of key-value pairs to achieve the effect of mutual decoupling of configuration data and application code. ConfigMaps can be used as environment variables for containers, command-line parameters, or configuration files in storage volumes.

Note

  • The data saved in ConfigMaps cannot exceed 1 MiB. If you need to store larger volumes of data, it is recommended to mount a storage volume or use an independent database or file service.

  • ConfigMaps do not provide confidentiality or encryption. If you want to store encrypted data, it is recommended to use secret, or other third-party tools to ensure the privacy of data.

You can create ConfigMaps with two methods:

  • Graphical form creation
  • YAML creation

Prerequisites

Graphical form creation

  1. Click the name of a cluster on the Clusters page to enter Cluster Details .

  2. In the left navigation bar, click ConfigMap and Secret -> ConfigMap , and click the Create ConfigMap button in the upper right corner.

  3. Fill in the configuration information on the Create ConfigMap page, and click OK .

    !!! note

     Click __Upload File__ to import an existing file locally to quickly create ConfigMaps.
    
  4. After the creation is complete, click More on the right side of the ConfigMap to edit YAML, update, export, delete and other operations.

YAML creation

  1. Click the name of a cluster on the Clusters page to enter Cluster Details .

  2. In the left navigation bar, click ConfigMap and Secret -> ConfigMap , and click the YAML Create button in the upper right corner.

  3. Fill in or paste the configuration file prepared in advance, and then click OK in the lower right corner of the pop-up box.

    !!! note

     - Click __Import__ to import an existing file locally to quickly create ConfigMaps.
     - After filling in the data, click __Download__ to save the configuration file locally.
    
  4. After the creation is complete, click More on the right side of the ConfigMap to edit YAML, update, export, delete and other operations.

ConfigMap YAML example

 ```yaml
 kind: ConfigMap
 apiVersion: v1
 metadata:
   name: kube-root-ca.crt
   namespace: default
   annotations:
 data:
   version: '1.0'
 ```

Next step: Use ConfigMaps

Comments