Bitzu

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

Single choice

What does base64 encoding of a Secret's data provide?

  1. Strong encryption of the value
  2. Hashing so the value cannot be recovered
  3. Only a reversible encoding, no confidentiality
  4. 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.

Select all that apply

Which practices improve the security of sensitive data in a cluster?

  1. Bake the API key into the container image
  2. Restrict who can get and list Secrets with RBAC
  3. Enable encryption at rest for Secrets
  4. Store the key in a public Git repository
  5. 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

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.

Download on the App StoreGet it on Google Play

More KCNA topics in this module