
Answer-first summary for fast verification
Answer: Store the credentials as a Kubernetes Secret and let the application access it via environment variables at runtime.
Storing the credentials as a Kubernetes Secret is the correct approach because it allows the application to access the credentials securely at runtime without the need to modify the code for different environments, update build pipelines, or insecurely store secrets within the container or registry.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
When deploying an application to a Kubernetes cluster that needs to securely connect to another service using a username and password, what is the best practice to ensure the credentials are used securely across multiple environments with minimal code changes?
A
Bundle the credentials with the code inside the container and secure the container registry.
B
Store the credentials as a Kubernetes ConfigMap and let the application access it via environment variables at runtime.
C
Leverage a CI/CD pipeline to update the variables at build time and inject them into a templated Kubernetes application manifest.
D
Store the credentials as a Kubernetes Secret and let the application access it via environment variables at runtime.