Bird
0
0

You want to securely provide database credentials to multiple microservices running in different namespaces. Which approach is best?

hard📝 Trade-off Q8 of 15
Microservices - Orchestration with Kubernetes
You want to securely provide database credentials to multiple microservices running in different namespaces. Which approach is best?
ACreate a single Secret in one namespace and reference it from others using Role-Based Access Control (RBAC)
BStore credentials in a ConfigMap and share it across namespaces
CCreate a Secret in each namespace with the same credentials
DHardcode credentials in each microservice's deployment YAML
Step-by-Step Solution
Solution:
  1. Step 1: Understand cross-namespace Secret sharing

    Secrets are namespace-scoped, and pods can only directly access Secrets in their own namespace.
  2. Step 2: Evaluate options

    Creating a Secret in each namespace with the same credentials is the feasible approach among the options, though credentials must be kept in sync. Create a single Secret in one namespace and reference it from others using Role-Based Access Control (RBAC) is not possible as cross-namespace references are unsupported. ConfigMaps are not secure for credentials. Hardcoding is highly insecure.
  3. Final Answer:

    Create a Secret in each namespace with the same credentials -> Option C
  4. Quick Check:

    Secure cross-namespace Secret sharing = B [OK]
Quick Trick: Create identical Secrets in each namespace [OK]
Common Mistakes:
MISTAKES
  • Attempting to reference a single Secret across namespaces with RBAC
  • Using ConfigMaps for sensitive data
  • Hardcoding credentials in YAML

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Microservices Quizzes