Kubernetes configmap Generator

The Kubernetes ConfigMap Generator safely decouples environment variables from container images. It scaffolds key-value pairs into consumable volume mounts or environment injections.

Loading editor...

How it Works

Step 1: Add Variables - Input the keys and values for your configuration data.

Step 2: Select Injection Strategy - Choose whether the data should be injected as environment variables or mounted as a file.

Step 3: Generate YAML - Export the ConfigMap manifest.

Why This Needs Its Own Logic

Hardcoding configuration data directly into Docker images violates the core principles of Twelve-Factor apps and makes images entirely non-portable across environments (dev vs staging vs prod). A ConfigMap solves this by storing non-confidential data in the cluster. However, ensuring that the Deployment manifest correctly references the ConfigMap keys is tedious. Our tool ensures the exact data structure is generated, preventing container crashes caused by missing configuration bindings.

Configuration Architecture Patterns

Decoupling configuration from code requires externalizing variables into cluster-native ConfigMaps.

Configuration KeyDefault BehaviorProduction Best Practice
Data StorageHardcoded in DockerfileExternalized in ConfigMap
InjectionManual env varsenvFrom: configMapRef
UpdatesRequires image rebuildHot-reloaded via volume mounts

Example Output

Here is a real generated snippet matching the production best practices above:

apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config