Interview Prep/Kubernetes/Services, DNS, Ingress and NetworkPolicy

A Pod in namespace `web` cannot resolve `redis`, which runs in namespace `cache`.

BeginnerTroubleshootingServices, DNS, Ingress and NetworkPolicy
Answer

Likely causes → Short names resolve only within the Pod's own namespace through the search list. redis becomes redis.web.svc.cluster.local, which does not exist.

Diagnose →

kubectl exec web-x -n web -- nslookup redis.cache.svc.cluster.local

Fix → Use redis.cache or the full redis.cache.svc.cluster.local in the app configuration.

Prevent → Always configure cross-namespace dependencies with <svc>.<namespace>.svc.cluster.local; it also avoids extra search-domain lookups.

All Kubernetes questions Roadmap: Kubernetes networking, storage & scaling

More on Services, DNS, Ingress and NetworkPolicy