Cloud and Container Basics
A database password is stored in a Kubernetes Secret. Which of the following correctly describes a Secret?
- AValues put in a Secret are automatically encrypted with strong cryptography, so no one in the cluster who reads them can learn the original password
- BSecret values cannot be referenced from containers, so the password has to be written in a configuration file inside the image
- CBy default the values are merely represented in Base64, which is not encryption, so restricting who can read them and encryption at rest are used as well
Show answer and explanation
Answer: C. By default the values are merely represented in Base64, which is not encryption, so restricting who can read them and encryption at rest are used as well
A Secret is a resource for managing confidential values such as passwords and API keys separately from images and Pod definitions and passing them to containers as environment variables or files. However, the values written in a manifest are only represented in Base64, which anyone can decode. Also, by default, they are stored unencrypted in etcd, where the cluster's data is kept. Measures such as limiting with RBAC who can read Secrets and enabling encryption at rest for etcd are therefore used together.
- A. Base64 is an encoding, not encryption. Anyone with permission to read the value can decode it.
- B. Secrets can be passed to containers as environment variables or files. A password written in the image becomes known to anyone who can pull the image.
- C. Correct. Base64 is not encryption, so combine it with access restrictions and encryption at rest.