ConfigMaps store non-sensitive configuration data as key-value pairs in Container Service for Kubernetes (ACK), decoupling configuration from container images. When configuration changes, update the ConfigMap instead of rebuilding the image.
Caution: ConfigMap data is stored unencrypted. Do not use ConfigMaps to store sensitive data such as passwords, tokens, or keys.
Prerequisites
Before you begin, ensure that you have:
An ACK managed cluster or ACK Serverless cluster. See Create an ACK managed cluster or Create an ACK Serverless cluster
Create a ConfigMap
Log on to the ACK consoleACK console. In the left-side navigation pane, click Clusters.
Click the cluster name, then choose Configurations > ConfigMaps in the left-side navigation pane.
On the ConfigMap page, select the namespace where you want to create the ConfigMap.
Create the ConfigMap using one of the following methods: Method 1: Use the form editor Method 2: Use YAML
In the upper-right corner, click Create.
In the Create panel, enter a name for the ConfigMap.
The name can contain lowercase letters, digits, hyphens (
-), and periods (.). Other resources reference this name to access the ConfigMap.
Click + Add, enter a key and a value, then click OK.
To populate the ConfigMap from a file, click Import to import a JSON file instead.
In the upper-right corner, click Create from YAML.
In the Sample Template drop-down list, select one of the following options:
Option
Description
Custom
Write the ConfigMap directly in YAML syntax
Resource - ConfigMap
Start from a pre-filled template named
aliyun-configthat includes sample filesgame.propertiesandui.properties. Modify it to fit your needs.Click Create.
Manage ConfigMaps
After creating a ConfigMap, perform the following operations on the ConfigMap page:
Updating a ConfigMap affects all applications that reference it.
| Operation | Steps |
|---|---|
| View details | Click the ConfigMap name |
| Edit (form) | Click Edit in the Actions column, then update values in the Name and Value columns |
| Edit (YAML) | Click Edit YAML in the Actions column, update the ConfigMap in the View in YAML panel, then click OK |
| Delete | Click Delete in the Actions column |
What's next
To use a ConfigMap in a Pod — as an environment variable, a command-line argument, or a mounted configuration file — see Configure a pod to use a ConfigMap.