Bird
0
0

You want to create two namespaces, dev and prod, and ensure pods in dev cannot access services in prod. Which approach is best?

hard📝 Best Practice Q15 of 15
Kubernetes - Namespaces
You want to create two namespaces, dev and prod, and ensure pods in dev cannot access services in prod. Which approach is best?
ACreate namespaces and use different node pools for each
BCreate namespaces and label pods with 'access=restricted' only
CCreate both namespaces and use NetworkPolicies to restrict access
DCreate namespaces and deploy all pods in the default namespace
Step-by-Step Solution
Solution:
  1. Step 1: Create separate namespaces

    Namespaces 'dev' and 'prod' isolate resources logically in the cluster.
  2. Step 2: Use NetworkPolicies to control traffic

    NetworkPolicies can restrict pod-to-service communication between namespaces effectively.
  3. Final Answer:

    Create both namespaces and use NetworkPolicies to restrict access -> Option C
  4. Quick Check:

    Namespaces + NetworkPolicies = access control [OK]
Quick Trick: Use NetworkPolicies with namespaces for access control [OK]
Common Mistakes:
  • Assuming labels alone restrict network access
  • Deploying all pods in default namespace ignores isolation
  • Using node pools does not isolate network traffic

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes