Namespaces in Kubernetes โ€“ Isolation, DNS,

TheTansihTheTansih
1 min read

๐Ÿ” 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 namespace

  • demo 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

0
Subscribe to my newsletter

Read articles from TheTansih directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

TheTansih
TheTansih