Namespaces in Kubernetes โ Isolation, DNS,

๐ What Happened?
Today, I was working with multiple namespaces in Kubernetes and ran into a small (but important) issue.
I had nginx pods running in:
default
namespacedemo
namespace (newly created)
Both were exposed using ClusterIP
services.
๐ค The Problem
When I tried to access nginx from another namespace, it failed โ not because of networking, but because the service name couldn't be resolved.
๐ง Why?
In Kubernetes, each namespace has its own DNS scope.
So, when you try to access a service from a different namespace, you need to use a fully qualified domain name (FQDN) like:
๐ ๏ธ The Fix
Once I used the FQDN, it worked perfectly!
Also verified all namespaces using:
I used the FQDN, it worked perfectly!
Also verified all namespaces using: kubectl get ns
Subscribe to my newsletter
Read articles from TheTansih directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
