Handbooks / Kubernetes / Chapter 4
ConfigMaps and Secrets
7 pages · ~5 min✓ Reviewed
Builds on Services and Ingress. Next up: Storage.
ConfigMaps and Secrets: The Mental Model
1. What They Are
| ConfigMap | Secret | |
|---|---|---|
| Holds | plain config | sensitive data |
| Shape | key/value, strings or files | same |
| Scope | namespaced | namespaced |
| Extra | none | tmpfs on node, redacted in describe |
| Stored | etcd | etcd |
2. Encoded, Not Encrypted
- base64 is reversible encoding, no key
- Anyone who can read the Secret can decode it
bash
echo -n 'pw' | base64
echo cHc= | base64 -doutput
cHc= pw
3. Write and Protect
data:= base64 valuesstringData:= plain text, converted on write, never returned- Pods consume both without an image rebuild
- At rest:
EncryptionConfigurationon the API server (etcd) - RBAC: restrict
get/liston secrets - Size limit 1 MiB per object