Interview Prep/Kubernetes/Services, Ingress and DNS

You must restrict an app so that only the frontend can call it. Services alone do not do that. What do you add?

AdvancedScenarioServices, Ingress and DNS
Answer

Situation read → Any pod in the cluster can call the backend today.

What I'd do →

  1. Confirm the CNI enforces NetworkPolicy (Calico, Cilium, or VPC CNI network policy mode)
  2. Create a default-deny ingress policy in the namespace
  3. Add an allow policy selecting backend pods and the frontend pod labels (plus namespaceSelector if cross-namespace)
  4. Allow DNS egress to kube-dns if you also restrict egress
  5. Test with kubectl exec from allowed and denied pods

Why → Services only provide discovery and load balancing. Isolation requires NetworkPolicy enforced by the CNI.

Interview tip → Mention that NetworkPolicy objects are silently ignored if the CNI does not implement them.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, Ingress and DNS