Containers & Orchestration

What is ConfigMap?

Definition

A ConfigMap is a Kubernetes API object used to store non-confidential configuration data in key-value pairs, which pods can consume as environment variables, command-line arguments, or configuration files.

A ConfigMap is a Kubernetes object that decouples configuration artifacts from container images, keeping workloads portable and environment-agnostic. It stores non-secret data as key-value pairs, where the value can be a short string, a multi-line text, or a binary file (encoded as a string). ConfigMaps are designed for configuration that does not require encryption; secrets are handled separately via the Secret object.

When a pod references a ConfigMap, Kubernetes injects the data before the container starts. This can happen in several ways: as environment variables (each key becomes an env var), as command-line arguments (using the Kubernetes downward API), or by mounting the ConfigMap as a volume (each key appears as a file in a specified path). For example, a ConfigMap with a key "nginx.conf" can be mounted at /etc/nginx/nginx.conf, allowing a single container image to serve different configurations across environments. ConfigMaps are namespace-scoped and can be updated at runtime, but existing pod environment variable references are not hot-reloaded; volume mounts can be updated without restarting the pod if the kubelet syncs the new data (which can take seconds to minutes depending on the sync period).

In the wider Kubernetes stack, ConfigMaps sit alongside Secrets, Volumes, and PodSpecs. They are often used in concert with Deployments or StatefulSets to parameterize workloads. While ConfigMaps are simple by design, they are subject to size limits (typically 1 MB per object in etcd) and are not suitable for large configuration files or binaries. For more complex or sensitive configuration, solutions such as External Secrets Operator, Helm values, or operator-specific CRDs are recommended.

Key facts

  • ConfigMap data is stored in etcd as plaintext; do not use for passwords or keys.
  • Pods reference ConfigMaps via envFrom, valueFrom, or volumeMounts in the pod spec.
  • Updates to a mounted ConfigMap are eventually reflected in the container filesystem.
  • ConfigMap names must be valid DNS subdomain names (RFC 1123 label).
  • A single ConfigMap can hold up to approximately 1 MB of data (etcd limit).

How it works in practice

A developer creates a ConfigMap named app-config with keys DB_HOST=db.example.com and LOG_LEVEL=debug. A Deployment's pod template references the ConfigMap using envFrom, so the container's environment automatically includes DB_HOST and LOG_LEVEL. To switch from staging to production, a new ConfigMap is deployed with different values, and the pods are rolled out with zero code changes.

Related terms

Secret Kubernetes Volume Downward API Environment Variable (Kubernetes) Deployment etcd

References

More in Containers & Orchestration

Container

A container is a lightweight, isolated runtime that packages an application with its dependencies using OS-level virtualization, enabling consistent execution across environments.

Container Image

A container image is a lightweight, standalone, executable package that includes everything needed to run a piece of software: code, runtime, system tools, libraries, and settings. It is the unit of distribution in container ecosystems like Docker and Kubernetes.

Container Registry

A container registry is a service that stores and distributes container images, enabling developers to push, pull, and version images across environments.

Container Runtime

A container runtime is the low-level software that creates, starts, and stops containers according to the OCI runtime specification, enabling process isolation and resource management.

Docker

Docker is a platform and toolchain for packaging, distributing, and running applications inside lightweight, portable containers, popularising the technology from 2013 onward.

Helm

Helm is a package manager for Kubernetes that uses charts to define, install, and upgrade complex applications as a single, versioned unit.

Ingress Controller

An Ingress Controller is a Kubernetes component that watches Ingress resources and configures a reverse proxy to route external HTTP and HTTPS traffic to services inside the cluster.

Init Container

An init container is a specialized container in a Kubernetes pod that runs to completion before any regular containers start, performing initialization or setup tasks.

Kubernetes

Kubernetes is an open source platform for automating the deployment, scaling, and management of containerized applications across clusters of hosts.

Operator

A Kubernetes Operator is a custom controller that extends the Kubernetes API to automate the management of a specific application, encoding human operational knowledge as code.

Who Is Online

In total there are 67 users online: 0 registered, 59 guests and 8 bots.

Most users ever online was 5,555 on 17 Jul 2026, 3:23 am.

Bots: AhrefsBot Applebot Baiduspider Bingbot Other Bot Other Crawler PetalBot SemrushBot

Users active in the past 15 minutes. Total registered members: 369