ConfigMap
What is ConfigMap?
ConfigMap: Stores non-secret configuration as key/value pairs. Mount it as files or inject it as environment variables — keeps config out of the image. A ConfigMap stores non-secret configuration for applications in Kubernetes as key and value pairs. Pods can read them as environment variables or as files mounted into the container.
Frequently asked questions about ConfigMap
How is ConfigMap used in practice?
This keeps configuration out of the image. The same image can run in staging and production with different settings, such as log level, feature flags or the URL of another service.
What should you keep in mind with ConfigMap?
Never put passwords, API keys or tokens in a ConfigMap. They are stored and shown in plain text. Use a Secret for those, ideally backed by a proper secret manager. Also note that changing a ConfigMap does not restart pods. Environment variables are only read at start-up, so after a change, restart the deployment to pick up the new values.
What does an example of ConfigMap look like?
apiVersion: v1 kind: ConfigMap metadata: name: app-config data: LOG_LEVEL: "info" feature.flags: "beta=on" At a glance
| Category | Kubernetes |
|---|---|
| Explained by | Reinier de la Parra |
| Updated |