Interview Prep/Kubernetes/Services, Ingress and DNS

Two namespaces need to call each other's services but you must keep them isolated otherwise. How?

IntermediateScenarioServices, Ingress and DNS
Answer

Situation read → team-a needs the API in team-b.

What I'd do →

  1. Use the FQDN api.team-b.svc.cluster.local
  2. Add a NetworkPolicy in team-b that allows ingress from namespaces with label team: a using namespaceSelector
  3. Ensure the default deny stays in place
  4. Allow DNS egress
  5. Test using a debug pod in team-a

Why → DNS is global across the cluster, so isolation must be enforced by policy, not naming.

Interview tip → Mention that namespace selectors rely on the automatic label kubernetes.io/metadata.name.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS