KCNA ยท Kubernetes security
Is a Kubernetes Secret encrypted?
Secret objects (base64 is not encryption), encryption at rest, external secret stores, avoiding secrets in images.
Key points
- Not by default.
- Secret values are only base64-encoded, which is an encoding, not protection, and are stored unencrypted in etcd.
- Anyone with API read access to the Secret, or with etcd access, can read them.
- Mitigate with encryption at rest (EncryptionConfiguration, ideally a KMS provider), least-privilege RBAC on Secrets, external secret stores such as the Secrets Store CSI Driver, and never baking credentials into images.
Source: https://kubernetes.io/docs/concepts/configuration/secret/
Practice questions
What does base64 encoding of a Secret's data provide?
- Strong encryption of the value
- Hashing so the value cannot be recovered
- Only a reversible encoding, no confidentiality
- Automatic rotation of the value
Show answer
Answer: C. Only a reversible encoding, no confidentiality
Base64 is a reversible encoding for representing binary data. It offers no confidentiality.
Which practices improve the security of sensitive data in a cluster?
- Bake the API key into the container image
- Restrict who can get and list Secrets with RBAC
- Enable encryption at rest for Secrets
- Store the key in a public Git repository
- Pull values from an external secret store
Show answer
Answer: B. Restrict who can get and list Secrets with RBAC, C. Enable encryption at rest for Secrets, E. Pull values from an external secret store
Encryption at rest, least-privilege RBAC and external secret stores all reduce exposure. Committing credentials to the image or repository exposes them to everyone who can pull it.
True or false: anyone allowed to create a Pod in a namespace can effectively read the Secrets in that namespace.
Show answer
Answer: True
True. A Pod can mount or expose any Secret in its namespace, so Pod-create rights are indirect Secret-read rights.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
