Use this when storing passwords and tokens for Kubernetes pods.
Secrets · Kubernetes Automation
Kubernetes Secrets store sensitive values like passwords and tokens for pods. They are only base64-encoded by default, so enable encryption at rest and use tools like Sealed Secrets or External Secrets for GitOps.
1. Kubernetes Secrets are base64, not encrypted by default.
2. Enable encryption at rest.
3. RBAC to restrict reads.
4. Manage via External Secrets/Sealed Secrets/SOPS.
5. Never commit plain secrets.
secret source → controller → Secret → pod
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as schema drift, selector overreach, admission rejection, controller lag, immutable fields, stale status and confusing created object with ready workload, choosing the cases most relevant to secret object identity, encryption-at-rest limitations, RBAC/service-account access, projection/environment exposure and rotation without logging secret values.
Step 2 Common mistakes Narrow the fault
- Treating base64 as encryption.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Secrets are base64, not encrypted, by default.
- Enable encryption at rest.
- Use Sealed Secrets or External Secrets for GitOps.
kubectl get secret <n> -o jsonpath='{.data}' | head -c 100— exists (avoid printing values)- External Secrets/Sealed Secrets/SOPS — git-safe secrets
- Encryption at rest (KMS) enabled — protection
ReferenceWhy it matters1 section · depth on demand
In depth
Kubernetes Secrets store sensitive data such as passwords, tokens and certificates and make them available to pods as environment variables or files. By default they are only base64-encoded in the API, not encrypted, so access control and encryption at rest matter.
Hardening:
| Measure | Purpose |
|---|---|
RBAC limiting get/list secrets | Few identities can read them |
| Encryption at rest (KMS provider) | Protect etcd data |
| Mount as files rather than env vars | Less exposure in process listings and crash dumps |
| External Secrets Operator / CSI driver | Source from Vault or cloud secret managers |
| Sealed Secrets / SOPS | Store encrypted secrets in Git for GitOps |
kubectl create secret generic netbox-token --from-literal=token=... --dry-run=client -o yaml
kubectl auth can-i get secrets --as=system:serviceaccount:tools:default -n tools
ReferenceImportant terms & boundaries1 section · depth on demand
Mechanics
The linked authority for bounded mechanics is Kubernetes Docs — Secrets; documentation support is separate from observed lab/production Evidence.
ReferenceConfiguration & state1 section · depth on demand
Lifecycle
Secrets belong in the platform's intended secret store and must not be copied into generated examples, logs or audit output.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Kubernetes Automation > Secrets. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://kubernetes.io/docs/concepts/configuration/secret/ · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For secret object identity, encryption-at-rest limitations, RBAC/service-account access, projection/environment exposure and rotation without logging secret values, prefer typed fields and stable IDs over human presentation text.