Secret encryption and rotation
Where a Secret needs protection
A Kubernetes Secret is an API object for confidential configuration, not an automatic guarantee of confidentiality. Base64 represents bytes as text; it is not encryption. A bookstore credential crosses several boundaries: API transport, persistent API storage, the node, and the consuming application. Protect each separately. A user allowed to create Pods in a namespace may also be able to arrange access to its Secrets, so restricting direct Secret reads alone is insufficient.
client → TLS → API server → encrypted storage (if configured) → kubelet → applicationEncryption at rest and KMS
API-server encryption configuration controls how selected resource data is stored. The first configured provider for a matching resource is used for new writes, with configured providers available to read existing formats. KMS v2 uses envelope encryption: data is encrypted with data keys while key material is protected through a KMS integration. This reduces exposure from raw storage access, but an authorized API read still returns usable data. Encryption does not replace RBAC, TLS, backup protection or application controls.
Conceptual only: Secret data → data encryption → encrypted storageKMS integration protects encryption key materialRotate storage keys without losing old data
Changing the write provider does not automatically rewrite old records. A reviewed migration must keep old data readable while new writes use the intended key. In a multi-server control plane, coordinate compatible configurations across servers before changing the write key; otherwise one server may not read another’s writes. Verify all relevant stored records have migrated, test restoration with backups, and only then retire old key material under an approved retention policy. The toy cases track versions, not actual ciphertext.
old key readable → coordinate readers → new writes → rewrite old records → verify recovery → retire old key when safeApplication credential rotation is different
A storage encryption key change does not change the password or token the application uses. Credential rotation needs coordination with the issuing service. When the issuer permits overlapping credentials, introduce the replacement, update consumers, verify successful authentication, then revoke the old credential. Without overlap, plan a controlled cutover. Keep version identifiers in audit evidence rather than printing secret values. Never roll back to a revoked credential.
issuer accepts v1 and v2 → application uses v2 → authentication check succeeds → revoke v1Volume updates and process reloads
A normal Secret volume receives updates eventually, not synchronously. An application must reopen or reload the file to consume the new value. Environment variables remain fixed for a running container, and a Secret mounted using subPath does not receive automatic updates. Replace the consuming Pod when appropriate. For immutable Secrets, plan replacement with a new object reference instead of editing data. These distinctions matter during credential expiry.
normal volume + reload → new version after propagationenvironment or subPath → controlled replacement requiredPractice: verify metadata without exposing data
Compare the rotation cases in the offline lab. Identify a stale process, an old storage record and an unsafe revocation. Propose a rollback that preserves valid access without exposing the credential. A successful model test is not evidence that etcd is encrypted or that an actual application reloaded. In an approved environment require independently reviewed storage evidence and application authentication tests; do not dump secrets into logs.
lab-fixtures/secret-identity/cases.jsonCheck Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Secret encryption and rotation — knowledge check
Interpret synthetic credential and trust evidence.
What does Base64 provide?
What happens to old records when a new write key is selected?
Does storage encryption replace Secret RBAC?
A running process reads a Secret via an environment variable. How does it get a changed value?
When should the old overlapping application credential be revoked?