📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Kubernetes ConfigMaps

ConfigMaps

5 min read Quiz at the end
Store non-sensitive configuration in ConfigMaps and inject as env vars or mounted files.

ConfigMaps

# Create ConfigMap
kubectl create configmap app-config   --from-literal=PORT=3000   --from-literal=ENV=production

# From file
kubectl create configmap nginx-conf --from-file=nginx.conf

# configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
data:
  PORT: "3000"
  ENV: production
  app.properties: |
    log.level=info
    cache.ttl=300

# Use in pod
envFrom:
  - configMapRef:
      name: app-config

# Or specific key
env:
  - name: PORT
    valueFrom:
      configMapKeyRef:
        name: app-config
        key: PORT
Topic Quiz · 1 questions

Test your understanding before moving on

1. How do you inject a ConfigMap value as an environment variable?
💡 Use env with valueFrom.configMapKeyRef to map a specific ConfigMap key to an env var.