ConfigMap — non-confidential configuration. Secret — base64-encoded sensitive data.
1# ConfigMap2apiVersion: v13kind: ConfigMap4metadata:5 name: app-config6data:7 DATABASE_HOST: "postgres"8 LOG_LEVEL: "info"9 config.json: |10 {"features": {"darkMode": true}}11---12# Secret13apiVersion: v114kind: Secret15metadata:16 name: app-secrets17type: Opaque18data:19 DB_PASSWORD: cGFzc3dvcmQxMjM= # base64 encoded20 API_KEY: c2VjcmV0a2V5
1# Usage in Pod2containers:3- name: app4 envFrom:5 - configMapRef:6 name: app-config7 - secretRef:8 name: app-secrets
Important: Secret is only base64, NOT encrypted. Use encryption at rest for true security.