Service Discovery and Namespaces
Learn about Service discovery in the context of namespaces.
We'll cover the following
Every Kubernetes object gets a name in the cluster address space, and we can partition the address space with Namespaces.
What is the cluster address space?
The cluster address space is a DNS domain that we usually call the cluster domain. On most clusters, it’s cluster.local
, and object names have to be unique within it. For example, we can only have one Service called cer in the default Namespace, and it will be called cer.default.svc.cluster.local
.
Long names like this are called fully qualified domain names (<object-name>.<namespace>.svc.cluster.local
.
We can use Namespaces to partition the address space below the cluster domain. For example, if our cluster has two Namespaces called dev and prod, the address space will be partitioned as follows:
dev:
<service-name>.dev.svc.cluster.local
prod:
<service-name>.prod.svc.cluster.local
Object names must be unique within a Namespace but not across Namespaces. As a quick example, the following figure shows a single cluster divided into two Namespaces called dev and prod. Both Namespaces have identical instances of the cer Service. This makes Namespaces a good tool for running parallel dev and prod configurations on the same cluster.
Get hands-on with 1400+ tech skills courses.