Kubernetes

ConfigMaps & Secrets

Separate configuration and sensitive data from images.

30 min read intermediate 3 objectives

Status

Not started

What you will learn

  • Inject config via env and volumes
  • Manage secrets
  • Avoid baking config into images

New to this? Start here

The basics, in plain English

Apps need settings (like a database URL) and secrets (like passwords). Kubernetes keeps these separate from your image so you can change them without rebuilding, and handle secrets more carefully.

Configuration
Settings your app reads at runtime, like which database to use.
ConfigMap
A Kubernetes object that holds non-secret settings as key-value pairs.
Secret
A special object for sensitive values like passwords and API keys.
Environment variable
A named value handed to your app when it starts, a common way to pass settings.
Why separate
So the same image can run in dev and prod with different settings, no rebuild needed.
01

Twelve-factor

ConfigMaps hold non-sensitive config, Secrets hold sensitive data (base64, not encrypted by default). Mount them as env vars or files.

Finished this topic?

Mark it done to earn 100 XP and keep your streak alive.