Bird
0
0

You want to allow a pod in namespace frontend to access a service backend in namespace api. Which steps are needed to enable this cross-namespace communication?

hard📝 Best Practice Q15 of 15
Kubernetes - Namespaces
You want to allow a pod in namespace frontend to access a service backend in namespace api. Which steps are needed to enable this cross-namespace communication?
AUse the full DNS name <code>backend.api.svc.cluster.local</code> and configure network policies to allow traffic from <code>frontend</code> to <code>api</code>
BCreate a service account in <code>frontend</code> and bind it to <code>api</code> namespace
CExpose the backend service as NodePort and access it via node IP
DDeploy the backend service in <code>frontend</code> namespace instead
Step-by-Step Solution
Solution:
  1. Step 1: Use correct DNS name for cross-namespace access

    Accessing a service in another namespace requires the full DNS name: backend.api.svc.cluster.local.
  2. Step 2: Configure network policies

    Network policies must allow traffic from pods in frontend namespace to api namespace services.
  3. Final Answer:

    Use the full DNS name backend.api.svc.cluster.local and configure network policies to allow traffic from frontend to api -> Option A
  4. Quick Check:

    DNS + network policy = cross-namespace communication [OK]
Quick Trick: Full DNS + network policy allow = cross-namespace access [OK]
Common Mistakes:
  • Confusing service accounts with network access
  • Using NodePort unnecessarily
  • Moving services instead of configuring access

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kubernetes Quizzes