Skip to the content.

⚙️ Kubernetes ConfigMap

Definition:

A ConfigMap is a Kubernetes object used to store configuration data separately from application code. It allows pods to consume configuration as environment variables, command-line arguments, or configuration files.


1️⃣ Key Features

Feature Description
Key-Value Storage Store configuration as key-value pairs
Pod Consumption Can be used as env variables, files, or command args
Decoupling Keeps configuration separate from application code
Dynamic Updates ConfigMap changes can be reflected in pods (with restart or volume mount)

2️⃣ How It Works (Flow)

ConfigMap
   |
   v
Pod consumes configuration
   |
   v
Application uses config dynamically

Example Usage:

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  LOG_LEVEL: "DEBUG"
  MAX_CONNECTIONS: "100"
env:
  - name: LOG_LEVEL
    valueFrom:
      configMapKeyRef:
        name: app-config
        key: LOG_LEVEL

3️⃣ Benefits


4️⃣ Analogy

Think of ConfigMap like a property file:


💡 Key takeaway: