Skip to content

ConfigMap

In one line

A ConfigMap is a Kubernetes resource that stores non-confidential configuration data in key-value pairs, separate from container images.

In simple words

A ConfigMap lets you store configuration data outside of your container image, so you can change configuration without rebuilding the image. It holds non-sensitive data as key-value pairs.

For example, you might store a database host name, a log level, or a feature flag URL in a ConfigMap. Your application reads these values at startup, and you can update them by editing the ConfigMap — no image rebuild needed.

ConfigMaps are perfect for environment-specific settings: you can have different ConfigMaps for development, staging, and production, all using the same container image. For sensitive data like passwords, use a Secret instead.

Example

yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  LOG_LEVEL: "debug"
  DB_HOST: "db.example.com"
  MAX_CONNECTIONS: "100"

This ConfigMap stores three configuration values that can be injected into a Pod as environment variables.

How it works

  1. You create a ConfigMap with key-value configuration data.
  2. You reference it in your Pod spec — as environment variables or mounted files.
  3. The container reads the configuration at startup.
  4. Update the ConfigMap and restart the Pod to apply changes.

Common confusions

  • Confused with: Secret

    The difference: ConfigMaps store non-sensitive data in plain text; Secrets store sensitive data like passwords and tokens, base64-encoded.

Related terms

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary