A ConfigMap is a type of resource that stores configuration information required by a workload. Its content is user-defined. After creating ConfigMaps, you can use them as files or environment variables in a containerized workload.
ConfigMaps allow you to decouple configuration files from container images to enhance the portability of workloads.
Benefits of ConfigMaps:
Parameter |
Description |
---|---|
Name |
Name of the ConfigMap you create, which must be unique in a namespace. |
Namespace |
Namespace to which the ConfigMap belongs. If you do not specify this parameter, the value default is used by default. |
Description |
Description of the ConfigMap. |
Data |
Data of a ConfigMap, in the key-value pair format. Click |
Label |
Label of the ConfigMap. Enter a key-value pair and click Confirm. |
The new ConfigMap is displayed in the ConfigMap list.
vi cce-configmap.yaml
apiVersion: v1 kind: ConfigMap metadata: name: cce-configmap data: SPECIAL_LEVEL: Hello SPECIAL_TYPE: CCE
Parameter |
Description |
---|---|
apiVersion |
The value is fixed at v1. |
kind |
The value is fixed at ConfigMap. |
metadata.name |
ConfigMap name, which can be customized. |
data |
ConfigMap data. The value must be key-value pairs. |
kubectl create -f cce-configmap.yaml
Run the following commands to view the created ConfigMap:
kubectl get cm
NAME DATA AGE cce-configmap 3 7m
Operation |
Description |
---|---|
Editing a YAML file |
Click Edit YAML in the row where the target ConfigMap resides to edit its YAML file. |
Updating a ConfigMap |
|
Deleting a ConfigMap |
Select the configuration you want to delete and click Delete. Follow the prompts to delete the ConfigMap. |