A Kubernetes deployment YAML for myapp1 contains the database password in plain text. To follow Google-recommended practices, what should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: Store the database password in a Kubernetes Secret and populate DB_PASSWORD from that Secret in the YAML..
Why this is the answer
Storing sensitive information like database passwords directly in deployment YAMLs is a security risk. Kubernetes Secrets are designed for managing sensitive data such as passwords, OAuth tokens, and SSH keys. They provide a more secure way to store and manage this information, preventing it from being exposed in plain text in your configuration files or source control. You can then reference these Secrets in your deployment YAML to inject the password as an environment variable or mount it as a file. Baking the password into the container image is also insecure, as anyone with access to the image can extract the password. ConfigMaps are for non-sensitive configuration data, not secrets. Storing the password on a persistent volume is generally not recommended for sensitive data as it can be accessed if the volume is compromised, and it doesn't integrate as cleanly with Kubernetes' native secret management.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed