Create a ConfigMap
Create a ConfigMap to store application configuration values as key-value pairs or file content.
Prerequisites
- The namespace where the ConfigMap will be used must exist.
Step 1. Open the Create ConfigMap form
Select Storage → ConfigMaps from the left sidebar. Click the Create config map button in the top right.
Step 2. Enter basic information
| Field | Description | Example |
|---|---|---|
| Name | ConfigMap name | app-config |
| Namespace | Target namespace | default |
Step 3. Add data entries
Click Add Data Entry to add items.
Key-Value format (single values)
| Key | Value |
|---|---|
LOG_LEVEL | info |
DB_HOST | db.example.com |
MAX_CONNECTIONS | 100 |
File format (multi-line values)
Enter the filename as the Key and the file content as the Value.
| Key | Value |
|---|---|
app.properties | server.port=8080\nlog.level=info |
nginx.conf | # nginx configuration... |
TIP
When using volume mounts, each Key stored as a file will be created as a file named after that Key inside the Pod.
Step 4. Confirm creation
Click Create. Verify the created entry in the ConfigMaps list.
Using the ConfigMap in a Pod
The ConfigMap can be injected into Pods in two ways:
- Environment variable: Deployment Edit Config → Environment Variables →
From ConfigMap - File mount: See Mount Volume →